/**
 * 地图筛选
 */ 
var Screening = {
    id: "ScreeningDiv"   //Div id
};

/**
 * 全局变量
 */

var radius;//半径
var point;//点对象
var map;//地图对象
var barChart;//柱状图对象
var lineChart;//折线图对象
var pieChart;//饼图对象
var realTimePassenger;//实时客流折线图对象
var peakPassengerFlow;//峰值客流折线图对象
var cumulativePassengerFlow;//累计客流柱状图对象
var cumulativePassengerFlowLine;//累计客流折线图对象
var staySituationBar;//逗留情况柱状图对象
var staySituationPie;//逗留情况饼图对象
var originBar;//客源地柱状图对象
var originPie;//客源地饼图对象
var passengerDensityLine;//客流密度柱状图对象
var permanentPopulationBar;//常驻人口柱状图对象
var permanentPopulationLine;//常驻人口折线图对象
var workForceBar;//工作人口柱状图对象
var passingPopulationBar;//途经人口柱线图对象
var workForceLine;//途经人口折线图对象
var travelPopulationBar;//出行人口柱线图对象
var sexDistributionLine;//性别分布折线图对象
var loyaltyBar//忠诚度柱线图对象
var loyaltyPie;//忠诚度柱饼图
var sexDistributionLine;//性别分布折线图
var sexDistributionBar;//性别分布柱线图
var sexDistributionPie;//性别分布饼图
var ageDistributionLine;//年龄分布折线图
var ageDistributionBar;//年龄分布柱状图
var ageDistributionPie;//年龄分布柱状图
var nativeDistributionBar;//籍贯分布柱状图
var nativeDistributionPie;//籍贯分布柱状图
var terminalDistributionBar;//终端分布柱状图
var terminalDistributionPie;//终端分布饼图
var monthlyDistributionBar;//月消费分布柱状图
var monthlyDistributionPie;//月消费分布饼图
var areaname;//区域名称
var staySituationRankingBar;//子区域平均逗留时长柱线图
//获取柱状图参数
function getBarOption(data){
    var barOption = {
        title : {
            text : "区域地市人流情况"
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data : ["用户数"]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                data : ["武汉","襄阳","鄂州","孝感","黄冈","黄石","咸宁","荆州","宜昌","恩施","十堰","随州","荆门","江汉","潜江","天门"]
            }
        ],
        yAxis : [
            {
                type : "value"
            }
        ],
        series : [
            {
                name:"用户数",
                type:"bar",
                data:data ,
                markPoint : {
                    data : [
                        {type : "max", name: "最大值"},
                        {type : "min", name: "最小值"}
                    ]
                },
                markLine : {
                    data : [
                        {type : "average", name: "平均值"}
                    ]
                }
            }
        ]
    };
    return barOption;
}

//获取累计客流柱状图参数
var cumulativePassengerX;
var cumulativePassengerY;
function getCumulativePassengerBarOption(data){
	var barOption = {
			 noDataLoadingOption: {
                 text: '暂无数据',
                 effect: 'bubble',
                 effectOption: {
                     effect: {
                         n: 0
                     }
                 }
			},
			title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : ["客流量"]
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : false,
	        xAxis : [
	            {
	                type : "category",
	                data : cumulativePassengerX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '客流(人)',
	            }
	        ],
	        series : [
	            {
	                name:"用户数",
	                type:"bar",
	                data:cumulativePassengerY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                }
	            }
	        ]
	    };
	    return barOption;
}


//获取累计客流折线图参数
function getCumulativePassengerLineOption(data){
	var lineOption = {
			noDataLoadingOption: {
                text: '暂无数据',
                effect: 'bubble',
                effectOption: {
                    effect: {
                        n: 0
                    }
                }
			},
			title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:['客流量']
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '时间',
                boundaryGap : false,
                data : cumulativePassengerX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [
            {
                name:"客流量",
                type:"line",
                data:cumulativePassengerY,
                markPoint : {
                    data : [
                        {type : "max", name: "人数峰值"},
                        {type : "min", name: "人数最低值"}
                    ]
                },
                markLine : {
                    data : [
                        {type : "average", name: "平均值"}
                    ]
                }
            }
        ]
    };
    return lineOption;
}


//获取实时客流折线图参数
function getRealTimPassengerLineOption(data){
    var lineOption = {
    		title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:['人数', '警戒', '饱和', '严重','客流预测']
        },
        grid:{
        	x:50,
        	right:'3%',
            y2:24,
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '时间',
                boundaryGap : false,
                axisLabel :{  
                    interval:realInterval
                },
                data : realPassengerX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
                scale : true,
            }
        ],
        series : [
            {
                name:"人数",
                type:"line",
                symbol: 'none',
                data:realAllPassengerData
            },
            {
                name:"客流预测",
                type:"line",
                symbolSize:0,
                data:realFluidPassengerData
            },
            {
                name:"警戒",
                type:"line",
                stack: '总量',
                symbol: 'none',
                data:realWarningValueData,
                itemStyle : { normal: {label : {show: true}}},
                markLine : {
                	 data : [
                             {type : "average", name: "平均值"}
                         ]
                }
            },
            {
                name:"饱和",
                type:"line",
                stack: '总量',
                symbol: 'none',
                data:realSaturationValueData,
                itemStyle : { normal: {label : {show: true}}},
                markLine : {
                	 data : [
                             {type : "average", name: "平均值"}
                         ]
                }
            },
            {
                name:"严重",
                type:"line",
                stack: '总量',
                symbol: 'none',
                data:realServerValueData,
                markLine : {
                    data : [
                        {type : "average", name: "平均值"}
                    ]
                },
            },
        ]
    };
    return lineOption;
}

function getPeakPassengerFlowOption(data){
    var lineOption = {
            title : {
                text:""
            },
            tooltip : {
                trigger: "axis",
                axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data:['客流峰值', '警戒', '饱和', '严重']
            },
            grid:{
                x:50,
                right: '3%',
                y2:24
            },
            calculable : true,
            xAxis : [
                {
                    type : "category",
                    name : '时间',
                    boundaryGap : false,
                    data : peakPassengerX
                }
            ],
            yAxis : [
                {
                    type : "value",
                    name : '客流(人)',
                }
            ],
            series : [
                {
                    name:"客流峰值",
                    type:"line",
                    stack:"总量",
                    data:peakData
                },
                {
                    name:"警戒",
                    type:"line",
                    stack:"总量",
                    symbol: 'none',
                    data:peakWarningValueData,
                    markLine : {
                        data : [
                            {type : "average", name: "警戒"}
                        ]
                    }
                },
                {
                    name:"饱和",
                    type:"line",
                    stack:"总量",
                    symbol: 'none',
                    data:peakSaturationValueData,
                    markLine : {
                        data : [
                            {type : "average", name: "饱和"}
                        ]
                    }
                },
                {
                    name:"严重",
                    type:"line",
                    stack:"总量",
                    symbol: 'none',
                    data:peakServerValueData,
                    markLine : {
                        data : [
                            {type : "average", name: "严重"}
                        ]
                    }
                },
            ]
        };
        return lineOption;
}

//获取逗留情况柱状图参数
//var staySituationX;
//var staySituationY;
//staySituationPieData=[];
//var staySituationDateX;
//var staySituationDateY;
function getStaySituationBarOption(data){
	var barOption = {
	        title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : ["客流量"]
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : false,
	        xAxis : [
	            {
	                type : "category",
	                name : '逗留时长',
	                data : staySituationDateX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '客流(人)',
	            }
	        ],
	        series : [
	            {
	                name:"客流(人)",
	                type:"bar",
	                data:staySituationDateY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                }
	            }
	        ]
	    };
	    return barOption;
}

//子区域平均逗留时长柱形图
function getStaySituationRankingBarOption(data){
	var barOption = {
	        title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : ["客流量"]
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : false,
	        xAxis : [
	            {
	                type : "category",
	                name : '子区域',
	                data : staySituationRankingDateX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '平均逗留时长',
	            }
	        ],
	        series : [
	            {
	                name:"平均逗留时长(小时/天)",
	                type:"bar",
	                data:staySituationRankingDateY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                }
	            }
	        ]
	    };
	    return barOption;
}


//获取折线图参数
function getLineOption(data){
    var lineOption = {
        title : {
            text: "区域年龄段人流情况"
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:["用户数"]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                data : ["0-9岁","10-19岁","20-29岁","30-39岁","40-49岁","50-59岁","60岁以上"]
            }
        ],
        yAxis : [
            {
                type : "value"
            }
        ],
        series : [
            {
                name:"用户数",
                type:"line",
                data:data,
                markPoint : {
                    data : [
                        {type : "max", name: "最大值"},
                        {type : "min", name: "最小值"}
                    ]
                },
                markLine : {
                    data : [
                        {type : "average", name: "平均值"}
                    ]
                }
            }
        ]
    };
    return lineOption;
}

//获取饼图参数
function getPieOption(data){
	var pieOption = {
	        title : {
	            text: "区域性别人流情况",
	            x:"left"
	        },
	        tooltip : {
	            trigger: "item",
	            formatter: "{a} <br/>{b} : {c} ({d}%)"
	        },
	        legend: {
	            x : "center",
	            data:["男性用户数","女性用户数"]
	        },
	        calculable : true,
	        series : [
	            {
	                name:"用户数",
	                type:"pie",
	                radius : "55%",
	                center: ["50%", "60%"],
	                data:data 
	            }
	        ]
	    };
	    return pieOption;
}

//获取逗留情况饼图参数
var staySituationPieDateY;
function getStaySituationPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:staySituationPieData,
                      itemStyle: {
                          emphasis: {
                              shadowBlur: 10,
                              shadowOffsetX: 0,
                              shadowColor: 'rgba(0, 0, 0, 0.5)'
                          }
                      }
            }
        ]
    };
    return pieOption;
}

/**
 * 地域分析页面
 * @param data
 * @returns
 */

//获取客源地柱状图参数
var originX;
var originY;
function getOriginBarOption(data){
	var barOption = {
	        title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : []
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : true,
	        xAxis : [
	            {
	                type : "category",
	                name : '省/市',
	                data : originX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '客流(人)',
	            }
	        ],
	        series : [
	            {
	                name:"客流量（人）",
	                type:"bar",
	                data:originY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                },
	                labelLine: {
	                	normal: {
	                	show: false
	                	}
	                }
	            }
	        ]
	    };
	    return barOption;
}

//获取客源地饼图参数
var originPieData;
function getOriginPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:originPieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                  	}
              	}
            }
        ]
    };
    return pieOption;
}

//获取客流密度柱状图参数
var passengerDensityDateY ;
var passengerDensityPercentDateY;
var passengerDensityDateX = [];
function getPassengerDensityLineOption(data){
	var barOption = {
			tooltip : {
				trigger : 'axis',
				axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
			},
			grid : {
				x:50,
	            right: '3%',
	            y2:24
			},
			toolbox : {
				feature : {
					dataView : {
						show : false,
						readOnly : false
					},
					restore : {
						show : false
					},
					saveAsImage : {
						show : false
					}
				}
			},
			legend : {
				data : lengendName
			},
			xAxis : [ {
				type : 'category',
				axisTick : {
					alignWithLabel : false
				},
				data : passengerDensityDateX,
			} ],
			yAxis : [ {
				type : 'value',
				name : '客流（人）',
				position : 'left',
				axisLabel : {
					formatter : '{value}'
				}
			}, {
				type : 'value',
				name : '密度指数',
				position : 'right',
				min : 0,
				max : 100,
				axisLabel : {
					formatter: '{value} %'  
				}
			} ],
			series : [
					{
						name : '客流（人）',
						type : 'bar',
						stack: "sum", 
						data : passengerDensityDateY
					},
					{
						name : '密度指数',
						type : 'bar',
						stack: "sum", 
						yAxisIndex : 1,
						data : passengerDensityPercentDateY
					} ]
	    };
	    return barOption;
}



/**
 * 行为分析页面
 * @param data
 * @returns
 */

var permanentPopulationDateX;
var permanentPopulationDateY;
function getPermanentPopulationBarOption(data){
	var barOption = {
			title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : []
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : true,
	        xAxis : [
	            {
	                type : "category",
	                name : '月份',
	                data : permanentPopulationDateX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '人口',
	            }
	        ],
	        series : [
	            {
	                name:"客流量（人）",
	                type:"bar",
	                data:permanentPopulationDateY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                },
	            }
	        ]
	    };
	    return barOption;
}

//获取常驻人口折线图参数
function getPermanentPopulationLineOption(data){
    var lineOption = {
    		title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:["常驻人口"],
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '月份',
                boundaryGap : false,
                data : permanentPopulationDateX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '人口',
            }
        ],
        series : [
            {
                name:"客流量",
                type:"line",
                stack:"总量",
                data:permanentPopulationDateY
            }
        ]
    };
    return lineOption;
}

//获取工作人口柱线图参数
var workForceDateX;
var workForceDateY;
function getWorkForceBarOption(data){
	var barOption = {
        title : {
            text : ""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data : []
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '月份',
                data : workForceDateX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '人口',
            }
        ],
        series : [
            {
                name:"客流量（人）",
                type:"bar",
                //barWidth:20,
                //barCategoryGap:10,
                data:workForceDateY,
                markPoint : {
                    data : [
                        {type : "max", name: "最大值"},
                        {type : "min", name: "最小值"}
                    ]
                },
                markLine : {
                    data : [
                        {type : "average", name: "平均值"}
                    ]
                },
            }
        ]
    };
    return barOption;
}

//获取工作人口折线图参数
function getWorkForceLineOption(data){
    var lineOption = {
    		title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:["工作人口"],
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '月份',
                boundaryGap : false,
                data : workForceDateX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '人口',
            }
        ],
        series : [
            {
                name:"客流量",
                type:"line",
                stack:"总量",
                data:workForceDateY
            }
        ]
    };
    return lineOption;
}

//获取途经人口柱线图参数
var passingPopulationBarX;
var passingPopulationBarY;
function getPassingPopulationBar(data){
	var barOption = {
	        title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : ["途经人口"]
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : true,
	        xAxis : [
	            {
	                type : "category",
	                name : '日期',
	                data : passingPopulationBarX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '客流（人）',
	            }
	        ],
	        series : [
	            {
	                name:"途经人口（人）",
	                type:"bar",
	                data:passingPopulationBarY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                },
	            }
	        ]
	    };
	    return barOption;
}

//获取途经人口折线图参数
function getPassingPopulationLineOption(data){
    var lineOption = {
    		title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:["平均"],
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '日期',
                boundaryGap : false,
                data : passingPopulationBarX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流（人）',
            }
        ],
        series : [
            {
                name:"途经人口（人）",
                type:"line",
                stack:"总量",
                data:passingPopulationBarY,
                markPoint : {
            	data : [
            	        {type : "max", name: "最大值"},
            	        {type : "min", name: "最小值"}
            	        ]
                },
                markLine : {  
            	data : [
            	        {type : "average", name: "平均值"}
            	        ]
                }
            }
        ]
    };
    return lineOption;
}


//获取出行人口柱线图参数
var travelPopulationDateX;
var travelPopulationDateY;
function getTravelPopulationBarOption(data){
	var barOption = {
			title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : ["出行人口"]
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : true,
	        xAxis : [
	            {
	                type : "category",
	                name : '日期',
	                data : travelPopulationDateX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '客流（人）',
	            }
	        ],
	        series : [
	            {
	                name:"出行人口（人）",
	                type:"bar",
	                data:travelPopulationDateY,
	            }
	        ]
	    };
	    return barOption;
}


//获取出行人口折线图参数
function getTravelPopulationLineOption(data){
    var lineOption = {
    		title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:["平均"],
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '日期',
                boundaryGap : false,
                data : travelPopulationDateX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流（人）',
            }
        ],
        series : [
            {
                name:"出行人口（人）",
                type:"line",
                stack:"总量",
                data:travelPopulationDateY,
                markPoint : {
            	data : [
            	        {type : "max", name: "最大值"},
            	        {type : "min", name: "最小值"}
            	        ]
                },
                markLine : {  
            	data : [
            	        {type : "average", name: "平均值"}
            	    ]
                }
            }
        ]
    };
    return lineOption;
}

//获取忠诚度柱线图参数
function getLoyaltyBarOption(data){
	var barOption = {
	        title : {
	            text : ""
	        },
	        tooltip : {
	            trigger: "axis",
	            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	            }
	        },
	        legend: {
	            data : ["人数"]
	        },
	        grid:{
	            x:50,
	            right: '3%',
	            y2:24
	        },
	        calculable : true,
	        xAxis : [
	            {
	                type : "category",
	                name : '次数',
	                data : loyaltyDateX
	            }
	        ],
	        yAxis : [
	            {
	                type : "value",
	                name : '客流（人）',
	            }
	        ],
	        series : [
	              {
	                name:"客流量（人）",
	                type:"bar",
	                data:loyaltyDateY,
	                markPoint : {
	                    data : [
	                        {type : "max", name: "最大值"},
	                        {type : "min", name: "最小值"}
	                    ]
	                },
	                markLine : {
	                    data : [
	                        {type : "average", name: "平均值"}
	                    ]
	                },
	            }
	        ]
	    };
	    return barOption;
}

//获取忠诚度饼图参数
function getLoyaltyPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:loyaltyPieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                  	}
              	}
            }
        ]
    };
    return pieOption;
}


/**
 * 属性分析页面
 * @param data
 * @returns
 */
//获取性别分布折线图参数
var sexInterval;
function getSexDistributionLineOption(data){
    var lineOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:['男','女','总人数']
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '时间',
                boundaryGap : false,
                axisLabel :{  
                    interval:sexInterval
                },
                data : sexDataTime
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [
            {
                name:"男",
                type:"line",
                data:sexManDateY,
            },
            {
                name:"女",
                type:"line",
                data:sexWomanDateY,
            },
            {
                name:"总人数",
                type:"line",
                data:allPeople,
            }
        ]
    };
    return lineOption;
}


//获取性别分布柱线图参数
function getSexDistributionBarOption(data){
    var barOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:[]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '性别',
                boundaryGap : true,
                data : sexBarDateX	
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [
            {
                name:"客流量",             
                type:"bar",
                data:sexBarDateY
            }
        ]
    };
    return barOption;
}

//获取性别分布饼图参数
function getSexDistributionPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:sexPieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                  	}
              	}
            }
        ]
    };
    return pieOption;
}

//获取年龄分布折线图参数
var ageInterval;
function getAgeDistributionLineOption(data){
    var lineOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:["0-9","10-19","20-29","30-39","40-49","50-59","60以上"]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : false,
        xAxis : [
            {
                type : "category",
                name : '日期',
                boundaryGap : false,
                axisLabel :{  
                    interval:ageInterval  
                },
                data : ageDataTime
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [
            {
            	name:"0-9",
                type:"line",
                data:nine,
            },
            {
                name:"10-19",
                type:"line",
                data:ninteen,
            },
            {
                name:"20-29",
                type:"line",
                data:twentyNine,
            },
            {
                name:"30-39",
                type:"line",
                data:thirtyNine,
            },
            {
                name:"40-49",
                type:"line",
                data:fourtyNine,
            },
            {
                name:"50-59",
                type:"line",
                data:fiftyNine,
            },
            {
                name:"60以上",
                type:"line",
                data:sixty,
            }
        ]
    };
    return lineOption;
}


//获取年龄分布柱线图参数
function getAgeDistributionBarOption(data){
    var barOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:[]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '年龄段',
                boundaryGap : true,
                data : ageBarDateX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [             
            {
                name:"客流量（人）",
                type:"bar",
                data:ageBarDateY,
            }
        ]
    };
    return barOption;
}


//获取年龄分布饼图参数
function getAgeDistributionPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:agePieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                  	}
              	}
            }
        ]
    };
    return pieOption;
}

//获取籍贯分布柱线图参数
var nativeDateX;
var nativeDateY;
function getNativeDistributionBarOption(data){
    var barOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:[]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '年龄段',
                boundaryGap : true,
                data : nativeDateX	
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [
             
            {
                name:"客流量（人）",
                type:"bar",
                data:nativeDateY,
            }
        ]
    };
    return barOption;
}

//获取籍贯分布饼图参数
function getNativeDistributionPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:pieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                  	}
              	}
            }
        ]
    };
    return pieOption;
}


//获取终端分布柱线图参数
var terminalDataX;
var terminalDataY;
function getTerminalDistributionBarOption(data){
    var barOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:[]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '品牌',
                boundaryGap : true,
                data : terminalDataX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '终端数量',
            }
        ],
        series : [
             
            {
                name:"客流量（人）",
                type:"bar",
                data:terminalDataY,
            }
        ]
    };
    return barOption;
}


//获取终端分布饼图参数
function getTerminalDistributionPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:terminalPieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                	}
            	}
            }
        ]
    };
    return pieOption;
}

//获取月消费分布柱线图参数
function getMonthlyDistributionBarOption(data){
    var barOption = {
        title : {
            text:""
        },
        tooltip : {
            trigger: "axis",
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:[]
        },
        grid:{
            x:50,
            right: '3%',
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : "category",
                name : '消费（元）',
                boundaryGap : true,
                axisLabel :{  
                    interval:1   
                },
                data : consumptionDataX
            }
        ],
        yAxis : [
            {
                type : "value",
                name : '客流(人)',
            }
        ],
        series : [
            {
                name:"客流量（人）",
                type:"bar",
                data:consumptionDataY,
            }
        ]
    };
    return barOption;
}


//获取月消费分布饼图参数
function getMonthlyDistributionPieOption(data){
    var pieOption = {
        title : {
            text: "",
            x:"center"
        },
        tooltip : {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            x : "center",
            data:[]
        },
        calculable : false,
        series : [
            {
                name:"客流量（人）",
                type:"pie",
                radius : "55%",
                center: ["50%", "60%"],
                data:consumptionPieData,
              	itemStyle: {
                  	emphasis: {
                      	shadowBlur: 10,
                      	shadowOffsetX: 0,
                      	shadowColor: 'rgba(0, 0, 0, 0.5)'
                  	}
              	}
            }
        ]
    };
    return pieOption;
}


//初始化实时客流折线图
function realTimPassengerLineInit(data){
	var lineOption = getRealTimPassengerLineOption(data);
	realTimePassenger.setOption(lineOption,true);
    $(window).resize(realTimePassenger.resize);
}

//初始化峰值客流折线图
function peakPassengerFlowLineInit(data){
	var lineOption = getPeakPassengerFlowOption(data);
	peakPassengerFlow.setOption(lineOption,true);
    $(window).resize(peakPassengerFlow.resize);
}

//初始化累计客流柱状图
function cumulativePassengerBarChartInit(data){
    var barOption = getCumulativePassengerBarOption(data);
    cumulativePassengerFlow.setOption(barOption,true);
    window.onresize = cumulativePassengerFlow.resize;
}

//初始化累计客流折线图
function cumulativePassengerLineChartInit(data){
    var lineOption = getCumulativePassengerLineOption(data);
    cumulativePassengerFlowLine.setOption(lineOption,true);
    window.onresize = cumulativePassengerFlowLine.resize;
}

//初始化逗留情况柱状图
function staySituationBarChartInit(data){
	var barOption = getStaySituationBarOption(data);
	staySituationBar.setOption(barOption,true);
    window.onresize = staySituationBar.resize;
}

//初始化逗留情况饼图
function staySituationPieChartInit(data){
	var pieOption = getStaySituationPieOption(data);
	staySituationPie.setOption(pieOption,true);
    window.onresize = staySituationPie.resize;
}

//初始化子区域平均逗留时长柱状图
function staySituationRankingBarChartInit(data){
	var barOption = getStaySituationRankingBarOption(data);
	staySituationRankingBar.setOption(barOption,true);
    window.onresize = staySituationRankingBar.resize;
}

/**
 * 地域分析页面
 * @param data
 * @returns
 */
//初始化客源地柱状图
function originBarChartInit(data){
    var barOption = getOriginBarOption(data);
    originBar.setOption(barOption,true);
    window.onresize = originBar.resize;
}

//初始化客源地饼图
function originPieChartInit(data){
	var pieOption = getOriginPieOption(data);
	originPie.setOption(pieOption,true);
    window.onresize = originPie.resize;
}

//初始化客流密度柱状图
function passengerDensityLineChartInit(data){
	var barOption = getPassengerDensityLineOption(data);
	passengerDensityLine.setOption(barOption,true);
    window.onresize = passengerDensityLine.resize;
}

/**
 * 行为分析页面
 * @param data
 * @returns
 */
//初始化常驻人口柱线图
function permanentPopulationBarChartInit(data){
	var barOption = getPermanentPopulationBarOption(data);
	permanentPopulationBar.setOption(barOption,true);
    window.onresize = permanentPopulationBar.resize;
}

//初始化常驻人口折线图
function permanentPopulationLineChartInit(data){
	var lineOption = getPermanentPopulationLineOption(data);
	permanentPopulationLine.setOption(lineOption,true);
    window.onresize = permanentPopulationLine.resize;
}

//初始化工作人口柱线图
function workForceBarChartInit(data){
	var barOption = getWorkForceBarOption(data);
	workForceBar.setOption(barOption,true);
    window.onresize = workForceBar.resize;
}

//初始化工作人口折线图
function workForceLineChartInit(data){
	var lineOption = getWorkForceLineOption(data);
	workForceLine.setOption(lineOption,true);
    window.onresize = workForceLine.resize;
}

//初始化途经人口柱线图
function passingPopulationBarChartInit(data){
	var barOption = getPassingPopulationBar(data);
	passingPopulationBar.setOption(barOption,true);
    window.onresize = passingPopulationBar.resize;
}

//初始化途经人口折线图
function passingPopulationLineChartInit(data){
	var lineOption = getPassingPopulationLineOption(data);
	passingPopulationLine.setOption(lineOption,true);
    window.onresize = passingPopulationLine.resize;
}

//初始化出行人口柱线图
function travelPopulationBarChartInit(data){
	var barOption = getTravelPopulationBarOption(data);
	travelPopulationBar.setOption(barOption,true);
    window.onresize = travelPopulationBar.resize;
}


//初始化出行人口折线图
function travelPopulationLineChartInit(data){
	var lineOption = getTravelPopulationLineOption(data);
	travelPopulationLine.setOption(lineOption,true);
    window.onresize = travelPopulationLine.resize;
}

//初始化忠诚度柱线图
function loyaltyBarChartInit(data){
	var barOption = getLoyaltyBarOption(data);
	loyaltyBar.setOption(barOption,true);
    window.onresize = loyaltyBar.resize;
}

//初始化忠诚度饼图
function loyaltyPieChartInit(data){
	var pieOption = getLoyaltyPieOption(data);
	loyaltyPie.setOption(pieOption,true);
    window.onresize = loyaltyPie.resize;
}

/**
 * 属性分析页面
 * 
 * @param data
 * @returns
 */
//初始化性别分布折线图
function sexDistributionLineChartInit(data){
    var lineOption = getSexDistributionLineOption(data);
    sexDistributionLine.setOption(lineOption,true);
    $(window).resize(sexDistributionLine.resize);
}

//初始化性别分布折线图
function sexDistributionBarChartInit(data){
    var barOption = getSexDistributionBarOption(data);
    sexDistributionBar.setOption(barOption,true);
    $(window).resize(sexDistributionBar.resize);
}

//初始化性别分布饼图
function sexDistributionPieChartInit(data){
    var pieOption = getSexDistributionPieOption(data);
    sexDistributionPie.setOption(pieOption,true);
    $(window).resize(sexDistributionPie.resize);
}

//初始化年龄分布折线图
function ageDistributionLineChartInit(data){
    var lineOption = getAgeDistributionLineOption(data);
    ageDistributionLine.setOption(lineOption,true);
    $(window).resize(ageDistributionLine.resize);
}

//初始化年龄分布柱状图
function ageDistributionBarChartInit(data){
    var barOption = getAgeDistributionBarOption(data);
    ageDistributionBar.setOption(barOption,true);
    $(window).resize(ageDistributionBar.resize);
}

//初始化年龄分布饼图
function ageDistributionPieChartInit(data){
    var pieOption = getAgeDistributionPieOption(data);
    ageDistributionPie.setOption(pieOption,true);
    $(window).resize(ageDistributionPie.resize);
}

//初始化籍贯分布柱状图
function nativeDistributionBarChartInit(data){
    var barOption = getNativeDistributionBarOption(data);
    nativeDistributionBar.setOption(barOption,true);
    $(window).resize(nativeDistributionBar.resize);
}

//初始化籍贯分布饼图
function nativeDistributionPieChartInit(data){
    var pieOption = getNativeDistributionPieOption(data);
    nativeDistributionPie.setOption(pieOption,true);
    $(window).resize(nativeDistributionPie.resize);
}

//初始化终端分布柱线图
function terminalDistributionBarChartInit(data){
    var barOption = getTerminalDistributionBarOption(data);
    terminalDistributionBar.setOption(barOption,true);
    $(window).resize(terminalDistributionBar.resize);
}

//初始化终端分布饼图
function terminalDistributionPieChartInit(data){
    var pieOption = getTerminalDistributionPieOption(data);
    terminalDistributionPie.setOption(pieOption,true);
    $(window).resize(terminalDistributionPie.resize);
}

//初始化月消费分布柱线图
function monthlyDistributionBarChartInit(data){
    var barOption = getMonthlyDistributionBarOption(data);
    monthlyDistributionBar.setOption(barOption,true);
    $(window).resize(monthlyDistributionBar.resize);
}

//初始化月消费分布饼图
function monthlyDistributionPieChartInit(data){
    var pieOption = getMonthlyDistributionPieOption(data);
    monthlyDistributionPie.setOption(pieOption,true);
    $(window).resize(monthlyDistributionPie.resize);
}

var noDataOption = {
	noDataLoadingOption: {
        text: '暂无数据',
        effect: 'bubble',
        effectOption: {
            effect: {
                n: 0
            }
        }
	},
    title :{
       text:""
    },
    series:[
        {}
    ]
};

//实时客流
var realPassengerAjax;
var realAllPassengerData;//实时客流（所有人口）
var realFluidPassengerData;//实时客流（流动人口）
var realWarningValueData;//实时客流（警戒值）
var realSaturationValueData;//饱和值
var realServerValueData;//严重值
var realPassengerX;
var realFluidPassengerArrayData;//预测客流
var realWarningValueDataArray = [];
var realSaturationValueDataArrayData = [];
var realServerValueDataArrayData = [];
function realPassenger(){
	var timeType = $("#selectRealPeopleTime").find("option:selected").text();
	var beginTime = realPassengerStartTime;
	var peopleType = $("#selectRealPeople").find("option:selected").text();
	realPassengerAjax = new $axSyn(Feng.ctxPath + "/screening/realPassenger?peopleType="+peopleType+"&beginTime="+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&timeType="+timeType, 
		function(data){
		realTimePassenger.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)',x: 6}
	    });
    	},
		function (data) {
        if(data.realPassengerTimes!=null&&data.realPassengerTimes.length>0){
        	realPassengerX = data.realPassengerTimes;
        	for(var i= 0;i<realPassengerX.length;i++){
        		realWarningValueDataArray.push(data.realWarningValue);
        		realSaturationValueDataArrayData.push(data.realSaturationValue);
        		realServerValueDataArrayData.push(data.realServerValue);
             } 
        	realWarningValueData = data.realWarningValue;
            realSaturationValueData = data.realSaturationValue;
            realServerValueData = data.realServerValue;
        	if(peopleType=="所有人口"){
        		realFluidPassengerData =  data.realFluidPerson;
        		realAllPassengerData = data.realAllPerson;
            }
            if(peopleType=="流动人口"){
            	realFluidPassengerData =  data.realFluidPerson;
            	realAllPassengerData = [];
            }
            if(timeType=="分钟"){
            	realInterval = 3;
            }else{
            	realInterval = 0;
            }
            realTimePassenger.clear();
            realTimPassengerLineInit(realPassengerX);
        }else{
        	realTimePassenger.setOption(noDataOption,true);
        }
    	loadingTicket = setTimeout(function (){
    		realTimePassenger.hideLoading();
         },2000);
    	
    }, function (data) {
    	loadingTicket = setTimeout(function (){
        	realTimePassenger.hideLoading();
        	realTimePassenger.setOption(noDataOption,true);
        },2000);
        
    });
	realPassengerAjax.start();
	
}

//实时客流导出
Screening.realPassengerExport = function(){
	var beginTime = realPassengerStartTime;
	var timeType = $("#selectRealPeopleTime").find("option:selected").text();
	var peopleType = $("#selectRealPeople").find("option:selected").text();
	var url = Feng.ctxPath+'/screenExport/realPassengerExport?beginTime='+beginTime+"&peopleType="+peopleType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname+"&timeType="+timeType;
	window.open(url);
}

//峰值客流请求
var peakPassengerAjax;
var peakAllPassengerData;//客流峰值（所有人口）
var peakFluidPassengerData;//客流峰值（流动人口）
var peakWarningValueData;//峰值客流（警戒值）
var peakSaturationValueData;//饱和值
var peakServerValueData;//严重值
var peakPassengerX;
var peakData;//峰值客流

function peakPassenger(){
	var timeType = $("#selectPeakPassengerFlow").find("option:selected").text();
	if(timeType=='日'){
		var beginTime = peakPassengerStartTime;
		var upTime = peakPassengerEndTime;
	}
	if(timeType=='月'){
		var beginTime = peakPassengerStartTime;
		var upTime = '';
	}
	var peopleType = $("#selectpeakPassenger").find("option:selected").text();
	peakPassengerAjax = new $axSyn(Feng.ctxPath + "/screening/peakPopulation?timeType="+timeType+"&peopleType="+peopleType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
		function(data){
		peakPassengerFlow.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.peakPassengerTimes!=null&&data.peakPassengerTimes.length>0){
        	if(peopleType=="所有人口"){
            	peakData = data.peakAllPerson;
            }
            if(peopleType=="流动人口"){
            	peakData = data.peakFluidPerson;
            }
			peakWarningValueData = data.peakWarningValue;
			peakSaturationValueData = data.peakSaturationValue;
			peakServerValueData = data.peakServerValue;
			peakPassengerX = data.peakPassengerTimes;
			peakPassengerFlowLineInit(peakPassengerX);
			loadingTicket = setTimeout(function (){
				peakPassengerFlow.hideLoading();
            },2000);
        }else{
        	loadingTicket = setTimeout(function (){
            	peakPassengerFlow.setOption(noDataOption,true);
            },2000);
        }
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		peakPassengerFlow.hideLoading();
    		peakPassengerFlow.setOption(noDataOption,true);
        },2000);
        
    });
	peakPassengerAjax.start();
}

//峰值客流导出
Screening.peakPassengerExport = function(){
	var timeType = $("#selectPeakPassengerFlow").find("option:selected").text();
	if(timeType=='日'){
		var beginTime = peakPassengerStartTime;
		var upTime = peakPassengerEndTime;
	}
	if(timeType=='月'){
		var beginTime = peakPassengerStartTime;
		var upTime = '';
	}
	var url = Feng.ctxPath+'/screenExport/peakPassengerExport?beginTime='+beginTime+"&upTime="+upTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//累计客流请求
var cumulativePassengerAjax;

function cumulativePassenger(){
	var timeType = $("#selectCumulativePassenger").find("option:selected").text();
	var peopleType = $("#selectCumulativePassengerPeople").find("option:selected").text();
	if(timeType=='日'){
		var beginTime = cumulativePassengerStartTime;
		var upTime = cumulativePassengerEndTime;
	}
	if(timeType=='月'){
		var beginTime = cumulativePassengerStartTime;
		var upTime = '';
	}
	cumulativePassengerAjax = new $axSyn(Feng.ctxPath + "/screening/cumulativePassenger?timeType="+timeType+"&peopleType="+peopleType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		cumulativePassengerFlow.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		cumulativePassengerFlowLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.cumulativePassengerTimes!=null&&data.cumulativePassengerTimes.length>0){
			if(peopleType=="所有人口"){
				cumulativePassengerY = data.comulativeAllPerson;
			}
			if(peopleType=="流动人口"){
				cumulativePassengerY = data.comulativeFluidPerson;
			}

			cumulativePassengerX = data.cumulativePassengerTimes;
			loadingTicket = setTimeout(function (){
				cumulativePassengerFlow.hideLoading();
				cumulativePassengerFlowLine.hideLoading();
            },2000);
			cumulativePassengerBarChartInit(cumulativePassengerX);
			cumulativePassengerLineChartInit(cumulativePassengerX);
        }else{
        	loadingTicket = setTimeout(function (){
        		cumulativePassengerFlow.setOption(noDataOption,true);
            	cumulativePassengerFlowLine.setOption(noDataOption,true);
            },2000);
        }        
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		cumulativePassengerFlow.hideLoading();
        	cumulativePassengerFlowLine.hideLoading();
        	cumulativePassengerFlow.setOption(noDataOption,true);
        },2000);
        
    });
	cumulativePassengerAjax.start();
}

//累计客流导出
Screening.cumulativePassengerExport = function(){
	var timeType = $("#selectCumulativePassenger").find("option:selected").text();
	if(timeType=='日'){
		var beginTime = cumulativePassengerStartTime;
		var upTime = cumulativePassengerEndTime;
	}
	if(timeType=='月'){
		var beginTime = cumulativePassengerStartTime;
		var upTime = '';
	}
	var url = Feng.ctxPath+'/screenExport/cumulativePassengerExport?beginTime='+beginTime+"&upTime="+upTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}
	

//常驻人口请求
var permanentAjax;
function permanent(){
	var beginTime = permanentStartTime;
	permanentAjax = new $axSyn(Feng.ctxPath + "/screening/permanent?beginTime="+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		permanentPopulationBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		permanentPopulationLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.permanentPeopleTimes!=null&&data.permanentPeopleTimes.length>0){
			permanentPopulationDateY = data.permanentPeople;
			permanentPopulationDateX = data.permanentPeopleTimes;
			loadingTicket = setTimeout(function (){
				permanentPopulationBar.hideLoading();
				permanentPopulationLine.hideLoading();
            },2000);
			permanentPopulationBarChartInit(cumulativePassengerX);
			permanentPopulationLineChartInit(cumulativePassengerX);
        }else{
        	loadingTicket = setTimeout(function (){
        		permanentPopulationBar.setOption(noDataOption,true);//常驻人口柱状图对象
            	permanentPopulationLine.setOption(noDataOption,true);//常驻人口折线图对象
            },2000);
        }
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		permanentPopulationBar.setOption(noDataOption,true);//常驻人口柱状图对象
        	permanentPopulationLine.setOption(noDataOption,true);//常驻人口折线图对象
        },2000);
        
    });
	permanentAjax.start();
}

//常驻人口导出
Screening.permanentPopulationExport = function(){
	var beginTime = permanentStartTime;
	var url = Feng.ctxPath+'/screenExport/permanentPopulationExport?beginTime='+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//工作人口请求
var workForceAjax;
function workForce(){
	var beginTime = workForceStartTime;
	workForceAjax = new $axSyn(Feng.ctxPath + "/screening/workForce?beginTime="+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		workForceBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		workForceLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },	
		function (data) {
        if(data.workingPopulationTimes!=null&&data.workingPopulationTimes.length>0){
        	workForceDateX = data.workingPopulationTimes;
        	workForceDateY = data.workingPopulation;
        	loadingTicket = setTimeout(function (){
        		workForceBar.hideLoading();
            	workForceLine.hideLoading();
            },2000);
        	workForceBarChartInit(workForceDateX);
        	workForceLineChartInit(workForceDateX);
        }else{
        	loadingTicket = setTimeout(function (){
        		workForceBar.setOption(noDataOption,true);//工作人口柱线图
            	workForceLine.setOption(noDataOption,true);//工作人口折线图
            },2000);
        }
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		workForceBar.setOption(noDataOption,true);//工作人口柱线图
        	workForceLine.setOption(noDataOption,true);//工作人口折线图
        },2000);
    });
	workForceAjax.start();
}

//工作人口导出
Screening.workForceExport = function(){
	var beginTime = workForceStartTime;
	var url = Feng.ctxPath+'/screenExport/workForceExport?beginTime='+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//途径人口请求
var passingPopulationAjax;
function passingPopulation(){
	var timeType = $("#selectPassingPopulation").find("option:selected").text();
	if(timeType=='天'){
		var beginTime = passingPopulationStartTime;
		var upTime = passingPopulationEndTime;
	}
	if(timeType=='小时'){
		var beginTime = passingPopulationStartTime;
		var upTime = '';
	}
	passingPopulationAjax = new $axSyn(Feng.ctxPath + "/screening/passingPopulation?timeType="+timeType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		passingPopulationBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		passingPopulationLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.passingPopulationTimes!=null&&data.passingPopulationTimes.length>0){
        	passingPopulationBarY = data.passingPopulation;
        	passingPopulationBarX = data.passingPopulationTimes;
        	loadingTicket = setTimeout(function (){
        		passingPopulationBar.hideLoading();
            	passingPopulationLine.hideLoading();
            },2000);
        	passingPopulationBarChartInit(passingPopulationBarX);
        	passingPopulationLineChartInit(passingPopulationBarX);
        }else{
        	loadingTicket = setTimeout(function (){
        		passingPopulationBar.setOption(noDataOption,true);
                passingPopulationLine.setOption(noDataOption,true);
            },2000);
        }
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		passingPopulationBar.setOption(noDataOption,true);
            passingPopulationLine.setOption(noDataOption,true);
        },2000);
        
    });
	passingPopulationAjax.start();

}

//途经人口导出
Screening.passingPopulationExport = function(){
	var timeType = $("#selectPassingPopulation").find("option:selected").text();
	if(timeType=='天'){
		var beginTime = passingPopulationStartTime;
		var upTime = passingPopulationEndTime;
	}
	if(timeType=='小时'){
		var beginTime = passingPopulationStartTime;
		var upTime = '';
	}
	var url = Feng.ctxPath+'/screenExport/passingPopulationExport?beginTime='+beginTime+"&upTime="+upTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}


//出行人口请求
var travelPopulationAjax;

function travelPopulation(){
	var timeType = $("#selectTravelPopulation").find("option:selected").text();
	if(timeType=='天'){
		var beginTime = travelPopulationStartTime;
		var upTime = travelPopulationEndTime;
	}
	if(timeType=='小时'){
		var beginTime = travelPopulationStartTime;
		var upTime = '';
	}
	travelPopulationAjax = new $axSyn(Feng.ctxPath + "/screening/travelPopulation?timeType="+timeType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
		function(data){
		travelPopulationBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		travelPopulationLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.travelPopulationTimes!=null&&data.travelPopulationTimes.length>0){
        	travelPopulationDateY = data.travelPopulation;
        	travelPopulationDateX = data.travelPopulationTimes;
        	loadingTicket = setTimeout(function (){
        		travelPopulationBar.hideLoading();
            	travelPopulationLine.hideLoading();
            },2000);
        	travelPopulationBarChartInit(travelPopulationDateX);
        	travelPopulationLineChartInit(travelPopulationDateX);
        }else{
        	loadingTicket = setTimeout(function (){
        		travelPopulationBar.setOption(noDataOption,true);
                travelPopulationLine.setOption(noDataOption,true);
            },2000);
        } 
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		travelPopulationBar.setOption(noDataOption,true);
            travelPopulationLine.setOption(noDataOption,true);
        },2000);
        
    });
	travelPopulationAjax.start();
	
}

//出行人口导出
Screening.travelPopulationExport = function(){
	var timeType = $("#selectTravelPopulation").find("option:selected").text();
	if(timeType=='天'){
		var beginTime = travelPopulationStartTime;
		var upTime = travelPopulationEndTime;
	}
	if(timeType=='小时'){
		var beginTime = travelPopulationStartTime;
		var upTime = '';
	}
	var url = Feng.ctxPath+'/screenExport/travelPopulationExport?beginTime='+beginTime+"&upTime="+upTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//客流密度请求
var passengerDensityAjax;
var lengendName;
function passengerDensity(){
	var timeType = $("#selectPassengerDensity").find("option:selected").text();
	if(timeType=='月'){
		var beginTime = passengerDensityStartTime;
		var upTime = passengerDensityEndTime;
	}
	if(timeType=='天'){
		var beginTime = passengerDensityStartTime;
		var upTime = '';
	}
	passengerDensityAjax = new $axSyn(Feng.ctxPath + "/screening/passengerDensity?timeType="+timeType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		passengerDensityLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.passingDensity!=null&&data.passingDensity.length>0){
        	passengerDensityDateY = data.passingDensity;
        	passengerDensityPercentDateY = data.passingDensityPercent;
        	passengerDensityDateX = data.passingDensityTime;
        	passengerDensityName = data.name;
        	var passengerDensityName = [];
        	passengerDensityName.push(data.name);
        	lengendName = passengerDensityName;
        	loadingTicket = setTimeout(function (){
        		passengerDensityLine.hideLoading();
            },2000);
        	passengerDensityLineChartInit(passengerDensityDateX);
        }else{
        	loadingTicket = setTimeout(function (){
        		passengerDensityLine.setOption(noDataOption,true);
            },2000);
        }		
    }, function (data) {
    	loadingTicket = setTimeout(function (){
    		passengerDensityLine.setOption(noDataOption,true);
        },2000);
        
    });
	passengerDensityAjax.start();	
}

//客流密度导出
Screening.passengerDensityExport = function(){
	var timeType = $("#selectPassengerDensity").find("option:selected").text();
	if(timeType=='月'){
		var beginTime = passengerDensityStartTime;
		var upTime = passengerDensityEndTime;
	}
	if(timeType=='天'){
		var beginTime = passengerDensityStartTime;
		var upTime = '';
	}
	var url = Feng.ctxPath+'/screenExport/passengerDensityExport?beginTime='+beginTime+"&upTime="+upTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//性别分布请求
var sexAjax;
var sexManDateY;
var sexWomanDateY;
var sexDataTime;
var sexSegmentaion;
var sexBarDateX;
var sexBarDateY;
var sexPieData = [];
var allSexDataMap;
var allPeople = [];//总人数

function sex(){
	var beginTime = sexStartTime;
	var upTime = sexEndTime;
	var timeType = $("#selectSexDistribution").find("option:selected").text();
	sexAjax = new $axSyn(Feng.ctxPath + "/screening/sex?timeType="+timeType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
		function(data){
		sexDistributionLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		sexDistributionBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		sexDistributionPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(timeType=="日"){
        	if(data.sexTimes!=null&&data.sexTimes.length>0){
        		sexDataTime = data.sexTimes;
        		sexSegmentaion = data.sexSegmentation;
        		sexBarDateX = data.sexSegmentation;
        		sexBarDateY = data.sumSexList;
        		sexWomanDateY = data.splitToMapList['女'];
        		sexManDateY = data.splitToMapList['男'];
        		var people = [];
        		if(sexManDateY!=null){
        			for(var i=0;i<sexManDateY.length;i++){
        				var sum = sexManDateY[i]+sexWomanDateY[i];
        				people.push(sum); 
        			}
        		}
        		allPeople = people;
        		var pie = [];
        		for(var i=0;i<sexBarDateY.length;i++){
        			pie.push({
        				name : sexBarDateX[i],
        				value : sexBarDateY[i]
        			}); 
        		}
        		sexInterval = 2;
        		sexPieData = pie;
        		if(sexManDateY==null){
        			loadingTicket = setTimeout(function (){
        				sexDistributionLine.setOption(noDataOption,true);;//性别分布折线图
                        sexDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
                        sexDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                    },2000);
        		}else{
        			loadingTicket = setTimeout(function (){
            			sexDistributionLine.hideLoading();
                		sexDistributionBar.hideLoading();
                		sexDistributionPie.hideLoading();
                    },2000);
            		sexDistributionLineChartInit(sexDataTime);
            		sexDistributionBarChartInit(sexBarDateX);
            		sexDistributionPieChartInit(sexPieData);
        		}
        	}else{
        		loadingTicket = setTimeout(function (){
        			sexDistributionLine.setOption(noDataOption,true);;//性别分布折线图
                    sexDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
                    sexDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                },2000);
            }
        }
        
        if(timeType=="月"){
        	if(data.sexTimes!=null&&data.sexTimes.length>0){
        		sexDataTime = data.sexTimes;
        		sexSegmentaion = data.sexSegmentation;
        		sexBarDateX = data.sexSegmentation;
        		sexBarDateY = data.sumSexList;
        		allSexDataMap = data.allSexMap;
        		sexManDateY = allSexDataMap["男"];
				sexWomanDateY = allSexDataMap["女"];
        		var people = [];
        		if(sexManDateY!=null){
        			for(var i=0;i<sexManDateY.length;i++){
        				var sum = sexManDateY[i]+sexWomanDateY[i];
        				people.push(sum); 
        			}
        		}
        		allPeople = people;
        		var pie = [];
        		sexInterval = 0;
        		for(var i=0;i<sexBarDateY.length;i++){
        			pie.push({
        				name : sexBarDateX[i],
        				value : sexBarDateY[i]
        			}); 
        		}
        		sexPieData = pie;
        		if(sexManDateY==null){
        			loadingTicket = setTimeout(function (){
        				sexDistributionLine.setOption(noDataOption,true);;//性别分布折线图
                        sexDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
                        sexDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                    },2000);
        		}else{
        			loadingTicket = setTimeout(function (){
            			sexDistributionLine.hideLoading();
                		sexDistributionBar.hideLoading();
                		sexDistributionPie.hideLoading();
                    },2000);
            		sexDistributionLineChartInit(sexDataTime);
            		sexDistributionBarChartInit(sexBarDateX);
            		sexDistributionPieChartInit(sexPieData);
        		}
        	}else{
        		loadingTicket = setTimeout(function (){
        			sexDistributionLine.setOption(noDataOption,true);;//性别分布折线图
                    sexDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
                    sexDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                },2000);
            }
        }       
    }, function (data) {
    	loadingTicket = setTimeout(function (){
			sexDistributionLine.setOption(noDataOption,true);;//性别分布折线图
            sexDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
            sexDistributionPie.setOption(noDataOption,true);;//性别分布饼图
        },2000);
        	
    });
	sexAjax.start();	
}

//性别分布导出
Screening.sexDistributionExport = function(){
	var beginTime = sexStartTime;
	var upTime = sexEndTime;
	var timeType = $("#selectSexDistribution").find("option:selected").text();
	var url = Feng.ctxPath+'/screenExport/sexDistributionExport?beginTime='+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname+"&timeType="+timeType;
	window.open(url);
}


//年龄分布请求
var ageAjax;
var ageDataTime;//时间分布
var ageSegmentation;//年龄分段
var ageSplitToMap;
var nine;//0-9
var ninteen;//10-19
var twentyNine;
var thirtyNine;
var fourtyNine;
var fiftyNine;
var sixty;
var ageBarDateX;
var ageBarDateY;
var agePieData=[];

function age(){
	var beginTime = ageStartTime;
	var upTime = ageEndTime;
	var timeType = $("#selectAgeDistribution").find("option:selected").text();
	ageAjax = new $axSyn(Feng.ctxPath + "/screening/age?timeType="+timeType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		ageDistributionLine.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		ageDistributionBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		ageDistributionPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(timeType=='日'){
        	if(data.ageSegmentationTimes!=null&&data.ageSegmentationTimes.length>0){
        		ageDataTime = data.ageSegmentationTimes;
        		ageSegmentation = data.ageSegmentation;
        		ageBarDateX = data.ageSegmentation;
        		ageBarDateY = data.sumAgeList;
        		var a = ageSegmentation[0];
        		ageSplitToMap = data.splitToMapList;
        		ageInterval = 2;
        		nine = ageSplitToMap["0-9"];
        		if(nine==null){
        			nine = [];
        		}
        		ninteen = ageSplitToMap["10-19"];
        		if(ninteen==null){
        			ninteen = [];
        		}
        		twentyNine = ageSplitToMap["20-29"];
        		if(twentyNine==null){
        			twentyNine = [];
        		}
        		thirtyNine = ageSplitToMap["30-39"];
        		if(thirtyNine==null){
        			thirtyNine = [];
        		}
        		fourtyNine = ageSplitToMap["40-49"];
        		if(fourtyNine==null){
        			fourtyNine = [];
        		}
        		fiftyNine = ageSplitToMap["50-59"];
        		if(fiftyNine==null){
        			fiftyNine = [];
        		}
        		sixty = ageSplitToMap["60+"];
        		if(sixty==null){
        			sixty = [];
        		}
        		var pie = [];
        		for(var i=0;i<ageBarDateY.length;i++){
        			pie.push({
        				name : ageBarDateX[i],
        				value : ageBarDateY[i]
        			}); 
        		}
        		agePieData = pie;
        		if(ageSplitToMap==null){
        			loadingTicket = setTimeout(function (){
        				ageDistributionLine.setOption(noDataOption,true);;//性别分布折线图
                		ageDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
                		ageDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                    },2000);
        		}else{
        			loadingTicket = setTimeout(function (){
        				ageDistributionLine.hideLoading();
        				ageDistributionBar.hideLoading();
        				ageDistributionPie.hideLoading();
                    },2000);
        			ageDistributionLineChartInit(ageDataTime);
            		ageDistributionBarChartInit(ageBarDateX);
            		ageDistributionPieChartInit(agePieData);
        		}
        	}else{
        		loadingTicket = setTimeout(function (){
        			ageDistributionLine.setOption(noDataOption,true);;//性别分布折线图
            		ageDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
            		ageDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                },2000);
        	}
        }
        if(timeType=='月'){
        	if(data.ageSegmentationTimes!=null&&data.ageSegmentationTimes.length>0>0){
        		ageDataTime = data.ageSegmentationTimes;
        		ageSegmentation = data.ageSegmentation;
        		ageBarDateX = data.ageSegmentation;
        		ageBarDateY = data.sumAgeList;
        		var a = ageSegmentation[0];
        		allAgeMapData = data.allAgeMap;
        		ageInterval = 0;
        		nine = allAgeMapData["0-9"];
        		if(nine==null){
        			nine = [];
        		}
        		ninteen = allAgeMapData["10-19"];
        		if(ninteen==null){
        			ninteen = [];
        		}
        		twentyNine = allAgeMapData["20-29"];
        		if(twentyNine==null){
        			twentyNine = [];
        		}
        		thirtyNine = allAgeMapData["30-39"];
        		if(thirtyNine==null){
        			thirtyNine = [];
        		}
        		fourtyNine = allAgeMapData["40-49"];
        		if(fourtyNine==null){
        			fourtyNine = [];
        		}
        		fiftyNine = allAgeMapData["50-59"];
        		if(fiftyNine==null){
        			fiftyNine = [];
        		}
        		sixty = allAgeMapData["60+"];
        		if(sixty==null){
        			sixty = [];
        		}
        		var pie = [];
        		for(var i=0;i<ageBarDateY.length;i++){
        			pie.push({
        				name : ageBarDateX[i],
        				value : ageBarDateY[i]
        			}); 
        		}
        		agePieData = pie;
        		if(allAgeMapData==null){
        			loadingTicket = setTimeout(function (){
        				ageDistributionLine.setOption(noDataOption,true);;//性别分布折线图
                		ageDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
                		ageDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                    },2000);
        		}else{
        			loadingTicket = setTimeout(function (){
        				ageDistributionLine.hideLoading();
        				ageDistributionBar.hideLoading();
        				ageDistributionPie.hideLoading();
                    },2000);
        			ageDistributionLineChartInit(ageDataTime);
            		ageDistributionBarChartInit(ageBarDateX);
            		ageDistributionPieChartInit();
        		}
        	}else{
        		loadingTicket = setTimeout(function (){
        			ageDistributionLine.setOption(noDataOption,true);;//性别分布折线图
            		ageDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
            		ageDistributionPie.setOption(noDataOption,true);;//性别分布饼图
                },2000);
        	   }
        	}
        
    }, function (data) {
    	loadingTicket = setTimeout(function (){
			ageDistributionLine.setOption(noDataOption,true);;//性别分布折线图
    		ageDistributionBar.setOption(noDataOption,true);;//性别分布柱线图
    		ageDistributionPie.setOption(noDataOption,true);;//性别分布饼图
        },2000);
        
    });
	ageAjax.start();
}

//年龄分布导出
Screening.ageExport = function(){
	var beginTime = ageStartTime;
	var upTime = ageEndTime;
	var timeType = $("#selectAgeDistribution").find("option:selected").text();
	var url = Feng.ctxPath+'/screenExport/ageExport?beginTime='+beginTime+"&upTime="+upTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//籍贯分布请求
//var nativePoupationAjax;
//var pieData=[];
//var nativeStartTime;
//var nativeEndTime;
//function nativePoupation(){
//	var beginTime = nativeStartTime;
//	var upTime = nativeEndTime;
//	var areaType = $("#selectNativeDistribution").find("option:selected").text();
//	nativePoupationAjax = new $axSyn(Feng.ctxPath + "/screening/nativePoupation?areaType="+areaType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
//		function(data){
//		nativeDistributionBar.showLoading({
//			text : 'loading',
//			textStyle: {
//				fontSize:20
//			},
//			effect : 'spin',
//			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
//	    });
//		nativeDistributionPie.showLoading({
//			text : 'loading',
//			textStyle: {
//				fontSize:20
//			},
//			effect : 'spin',
//			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
//	    });
//    },
//		function (data) {
//        if(data.nativePopulationName!=null&&data.nativePopulationName.length>0){
//        	nativeDateY = data.nativePopulationDate;
//        	nativeDateX = data.nativePopulationName;
//        	var pie = [];
//        	for(var i=0;i<nativeDateY.length;i++){
//        		pie.push({
//        			name : nativeDateX[i],
//        			value : nativeDateY[i]
//        		}); 
//        	}
//        	pieData = pie;
//        	loadingTicket = setTimeout(function (){
//        		nativeDistributionBar.hideLoading();
//            	nativeDistributionPie.hideLoading();
//            },2000);
//        	nativeDistributionBarChartInit(nativeDateX);
//        	nativeDistributionPieChartInit(pieData);
//        }else{
//        	loadingTicket = setTimeout(function (){
//        		nativeDistributionBar.setOption(noDataOption,true);
//            	nativeDistributionPie.setOption(noDataOption,true);
//            },2000);
//        }    		        
//    },function (data) {
//    	loadingTicket = setTimeout(function (){
//    		nativeDistributionBar.setOption(noDataOption,true);
//        	nativeDistributionPie.setOption(noDataOption,true);
//        },2000);
//    });
//	nativePoupationAjax.start();
//}

//终端分布请求
var terminalAjax;
var terminalPieData=[];

function terminalPoupation(){
	var beginTime = terminalStartTime;
	var upTime = terminalEndTime;
	terminalAjax = new $axSyn(Feng.ctxPath + "/screening/terminal?beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId, 
		function(data){
		terminalDistributionBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		terminalDistributionPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.terminalPopulationName!=null&&data.terminalPopulationName.length>0){
        	terminalDataY = data.terminalPopulationDate;
        	terminalDataX = data.terminalPopulationName;
        	var pie = [];
        	for(var i=0;i<terminalDataY.length;i++){
        		pie.push({
        			name : terminalDataX[i],
        			value : terminalDataY[i]
        		}); 
        	}
        	terminalPieData = pie;
        	loadingTicket = setTimeout(function (){
        		terminalDistributionBar.hideLoading();
            	terminalDistributionPie.hideLoading();
            },2000);
        	terminalDistributionBarChartInit(terminalDataX);
        	terminalDistributionPieChartInit(terminalPieData);
        }else{
        	loadingTicket = setTimeout(function (){
        		terminalDistributionBar.setOption(noDataOption,true);//终端分布柱状图
                terminalDistributionPie.setOption(noDataOption,true);//终端分布饼图
            },2000);
        }
    },function (data) {
    	loadingTicket = setTimeout(function (){
    		terminalDistributionBar.setOption(noDataOption,true);//终端分布柱状图
            terminalDistributionPie.setOption(noDataOption,true);//终端分布饼图
        },2000);
        
    });
	terminalAjax.start();
}

//终端分布导出
Screening.terminalDistributionExport = function(){
	var beginTime = terminalStartTime;
	var upTime = terminalEndTime;
	var url = Feng.ctxPath+'/screenExport/terminalDistributionExport?beginTime='+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//客源地请求
var originAjax;
var originPieData=[];
function originlPoupation(){
	var beginTime = originPassengerStartTime;
	var upTime = originPassengerEndTime;
	var areaType = $("#selectOrigin").val();
	originAjax = new $axSyn(Feng.ctxPath + "/screening/origin?areaType="+areaType+"&beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
		function(data){
		originBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		originPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.originPopulationName!=null&&data.originPopulationName.length>0){
        	originY = data.originPopulationDate;
        	originX = data.originPopulationName;
        	var pie = [];
        	for(var i=0;i<originY.length;i++){
        		pie.push({
        			name : originX[i],
        			value : originY[i]
        		}); 
        	}
        	originPieData = pie;
        	loadingTicket = setTimeout(function (){
        		originBar.hideLoading();
            	originPie.hideLoading();
            },2000);
        	originBarChartInit(originX);
        	originPieChartInit(originPieData);
        }else{
        	loadingTicket = setTimeout(function (){
        		originBar.setOption(noDataOption,true);
                originPie.setOption(noDataOption,true);
            },2000);
        }
    },function (data) {
    	loadingTicket = setTimeout(function (){
    		originBar.setOption(noDataOption,true);
            originPie.setOption(noDataOption,true);
        },2000);
        
    });
	originAjax.start();
}

//客源地导出
Screening.originExport = function(){
	var beginTime = originPassengerStartTime;
	var upTime = originPassengerEndTime;
	var areaType = $("#selectOrigin").val();
	var url = Feng.ctxPath+'/screenExport/originExport?beginTime='+beginTime+"&upTime="+upTime+"&areaType="+areaType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//月消费分布请求
var consumptionAjax;
var consumptionPieData=[];
var consumptionDataX;
var consumptionDataY;
//var monthlyStartTime;
//var monthlyEndTime;
function consumptionPoupation(){
	var beginTime = monthlyStartTime;
	var upTime = monthlyEndTime;
	consumptionAjax = new $axSyn(Feng.ctxPath + "/screening/consumption?beginTime="+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
		function(data){
		monthlyDistributionBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		monthlyDistributionPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.consumptionName!=null&&data.consumptionName.length>0){
        	consumptionDataY = data.consumptionDate;
        	consumptionDataX = data.consumptionName;
        	var pie = [];
        	for(var i=0;i<consumptionDataY.length;i++){
        		pie.push({
        			name : consumptionDataX[i],
        			value : consumptionDataY[i]
        		}); 
        	}
        	consumptionPieData = pie;
        	loadingTicket = setTimeout(function (){
        		monthlyDistributionBar.hideLoading();
            	monthlyDistributionPie.hideLoading();
            },2000);
        	monthlyDistributionBarChartInit(consumptionDataX);
        	monthlyDistributionPieChartInit(consumptionPieData);
        }else{
        	loadingTicket = setTimeout(function (){
        		monthlyDistributionBar.setOption(noDataOption,true);//月消费分布柱状图
            	monthlyDistributionPie.setOption(noDataOption,true);//月消费分布饼图
            },2000);
        }
    },function (data) {
    	loadingTicket = setTimeout(function (){
    		monthlyDistributionBar.setOption(noDataOption,true);//月消费分布柱状图
        	monthlyDistributionPie.setOption(noDataOption,true);//月消费分布饼图
        },2000);
        
    });
	consumptionAjax.start();
}

//月消费分布导出
Screening.monthlyConsumptionExport = function(){
	var beginTime = monthlyStartTime;
	var upTime = monthlyEndTime;
	var url = Feng.ctxPath+'/screenExport/monthlyConsumptionExport?beginTime='+beginTime+"&upTime="+upTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//逗留情况分布请求
var staySituationAjax;
var staySituationPieData=[];
var staySituationDateX;
var staySituationDateY;
function stayPoupation(){
	var timeType = $("#selectStaySituationTime").find("option:selected").text();
	var beginTime = staySituationStartTime;
	staySituationAjax = new $axSyn(Feng.ctxPath + "/screening/staySituation?beginTime="+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&timeType="+timeType,
		function(data){
		staySituationBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		staySituationPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.staySituationName!=null&&data.staySituationName.length>0){
        	staySituationDateY = data.staySituationDate;
        	staySituationDateX = data.staySituationName;
        	var pie = [];
        	for(var i=0;i<staySituationDateY.length;i++){
        		pie.push({
        			name : staySituationDateX[i],
        			value : staySituationDateY[i]
        		}); 
        	}
        	staySituationPieData = pie;
        	loadingTicket = setTimeout(function (){
        		staySituationBar.hideLoading();
        		staySituationPie.hideLoading();
            },2000);
        	staySituationBarChartInit(staySituationDateX);
        	staySituationPieChartInit(staySituationPieData);
        }else{
        	loadingTicket = setTimeout(function (){
        		staySituationBar.setOption(noDataOption,true);
        		staySituationPie.setOption(noDataOption,true);
            },2000);
        }
    },function (data) {
    	loadingTicket = setTimeout(function (){
    		staySituationBar.setOption(noDataOption,true);
    		staySituationPie.setOption(noDataOption,true);
        },2000);
        
    });
	staySituationAjax.start();
}

//逗留情况导出
Screening.staySituationExport = function(){
	var timeType = $("#selectStaySituationTime").find("option:selected").text();
	var beginTime = staySituationStartTime;
	var url = Feng.ctxPath+'/screenExport/staySituationExport?beginTime='+beginTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//忠诚度分布请求
var loyaltyAjax;
var loyaltyPieData=[];
var loyaltyDateX;
var loyaltyDateY;
function loyaltyPoupation(){
	var beginTime = loyaltyStartTime;
	loyaltyAjax = new $axSyn(Feng.ctxPath + "/screening/loyaltySituation?beginTime="+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId,
		function(data){
		loyaltyBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
		loyaltyPie.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.loyaltySituationName!=null&&data.loyaltySituationName.length>0){
        	loyaltyDateY = data.loyaltySituationDate;
        	loyaltyDateX = data.loyaltySituationName;
        	var pie = [];
        	for(var i=0;i<loyaltyDateY.length;i++){
        		pie.push({
        			name : loyaltyDateX[i],
        			value : loyaltyDateY[i]
        		}); 
        	}
        	loyaltyPieData = pie;
        	loadingTicket = setTimeout(function (){
        		loyaltyBar.hideLoading();
        		loyaltyPie.hideLoading();
            },2000);
        	loyaltyBarChartInit(loyaltyDateX);
        	loyaltyPieChartInit(loyaltyPieData);
        }else{
        	loadingTicket = setTimeout(function (){
        		loyaltyBar.setOption(noDataOption,true);
        		loyaltyPie.setOption(noDataOption,true);
            },2000);
        }
    },function (data) {
    	loadingTicket = setTimeout(function (){
    		loyaltyBar.setOption(noDataOption,true);
    		loyaltyPie.setOption(noDataOption,true);
        },2000);
        
    });
	loyaltyAjax.start();
}

//忠诚度导出
Screening.loyaltyPopulationExport = function(){
	var beginTime = loyaltyStartTime;
	var url = Feng.ctxPath+'/screenExport/loyaltyPopulationExport?beginTime='+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&areaname="+areaname;
	window.open(url);
}

//子区域逗留时长排名
staySituationRankingStartTime
var staySituationRankingAjax;
var staySituationRankingDateX;
var staySituationRankingDateY;
function stayPoupationRanking(){
	var timeType = $("#selectStaySituationRankingTime").find("option:selected").text();
	var beginTime = staySituationRankingStartTime;
	staySituationRankingAjax = new $axSyn(Feng.ctxPath + "/screening/staySituationRanking?beginTime="+beginTime+"&areaId="+areaId+"&subAreaId="+subAreaId+"&timeType="+timeType,
		function(data){
		staySituationRankingBar.showLoading({
			text : 'loading',
			textStyle: {
				fontSize:20
			},
			effect : 'spin',
			effectOption: {backgroundColor: 'rgba(128, 128, 128, 0.7)'}
	    });
    },
		function (data) {
        if(data.stayRankingName!=null&&data.stayRankingName.length>0){
        	staySituationRankingDateY = data.stayRankingTime;
        	staySituationRankingDateX = data.stayRankingName;
        	loadingTicket = setTimeout(function (){
        		staySituationRankingBar.hideLoading();
            },2000);
        	staySituationRankingBarChartInit(staySituationRankingDateX);
        }else{
        	loadingTicket = setTimeout(function (){
        		staySituationRankingBar.setOption(noDataOption,true);
            },2000);
        }
    },function (data) {
    	loadingTicket = setTimeout(function (){
    		staySituationRankingBar.setOption(noDataOption,true);
        },2000);
        
    });
	staySituationRankingAjax.start();
}

//子区域逗留时长排名导出
Screening.staySituationRankingExport = function(){
	var timeType = $("#selectStaySituationRankingTime").find("option:selected").text();
	var beginTime = staySituationRankingStartTime;
	var url = Feng.ctxPath+'/screenExport/staySituationRankingExport?beginTime='+beginTime+"&timeType="+timeType+"&areaId="+areaId+"&subAreaId="+subAreaId;
	window.open(url);
}

function areaReset(){
	cumulativePassenger();//累计客流请求
	permanent();//常驻人口请求
	workForce();//工作人口请求
	passingPopulation();//途经人口请求
	travelPopulation();//出行人口
	sex();//性别分布
	age();//年龄分布
//	nativePoupation();//籍贯分布请求
	terminalPoupation();//终端分布
	originlPoupation();//客源地请求
	consumptionPoupation();//月消费分布
	peakPassenger();//峰值客流请求
	realPassenger();//实时客流
	passengerDensity();//客流密度请求
	stayPoupation();//逗留情况
	loyaltyPoupation();//忠诚度
	stayPoupationRanking();//子区域逗留时长排名
}

function componentReset(){
	if($("#cumulativePassengerFlow").length > 0) {
	cumulativePassenger();//累计客流请求
	}
	if($("#permanentPopulationBar").length > 0) {
	permanent();//常驻人口请求
	}
	if($("#workForceBar").length > 0) {
	workForce();//工作人口请求
	}
	if($("#passingPopulationBar").length > 0) {
	passingPopulation();//途经人口请求
	}
	if($("#travelPopulationBar").length > 0) {
	travelPopulation();//出行人口
	}
	if($("#sexDistributionLine").length > 0) {
	sex();//性别分布
	}
	if($("#ageDistributionLine").length > 0) {
	age();//年龄分布
	}
//	nativePoupation();//籍贯分布请求
	if($("#terminalDistributionBar").length > 0) {
	terminalPoupation();//终端分布
	}
	if($("#originBar").length > 0) {
	originlPoupation();//客源地请求
	}
	if($("#monthlyDistributionBar").length > 0) {
	consumptionPoupation();//月消费分布
	}
	if($("#peakPassengerFlow").length > 0) {
	peakPassenger();//峰值客流请求
	}
	if($("#realTimePassenger").length > 0) {
	realPassenger();//实时客流
	}
	if($("#passengerDensityLine").length > 0) {
	passengerDensity();//客流密度请求
	}
	if($("#staySituationBar").length > 0) {
	stayPoupation();//逗留情况
	}
	if($("#loyaltyBar").length > 0) {
	loyaltyPoupation();//忠诚度
	}
	if($("#staySituationRankingBarChart").length > 0){
		stayPoupationRanking();
	}
    //map.clearOverlays();
}
//实时客流柱形图折线图切换
Screening.cumulativePassengerBar = function () {
	$("#cumulativePassengerFlowLineId").hide();
	$("#cumulativePassengerFlowBarId").show();
};
//实时客流柱形图折线图切换
Screening.cumulativePassengerLine = function () {
	$("#cumulativePassengerFlowBarId").hide();
	$("#cumulativePassengerFlowLineId").show();
	$("#cumulativePassengerFlowLineId").removeClass("hidden");
};

//逗留情况柱形图饼图切换
Screening.staySituationBar = function () {
	$("#staySituationPieId").hide();
	$("#staySituationBarId").show();
};
//逗留情况柱形图饼图切换
Screening.staySituationPie = function () {
	$("#staySituationBarId").hide();
	$("#staySituationPieId").show();
	$("#staySituationPieId").removeClass("hidden");
};

//客源地柱形图饼图切换
Screening.originBar = function () {
	$("#originPieId").hide();
	$("#originBarId").show();
};
//客源地柱形图饼图切换
Screening.originPie = function () {
	$("#originBarId").hide();
	$("#originPieId").show();
	$("#originPieId").removeClass("hidden");
};

//常驻人口柱形图折线图切换
Screening.permanentPopulationBar = function () {
	$("#permanentPopulationLineId").hide();
	$("#permanentPopulationBarId").show();
};

//常驻人口柱形图折线图切换
Screening.permanentPopulationLine = function () {
	$("#permanentPopulationBarId").hide();
	$("#permanentPopulationLineId").show();
	$("#permanentPopulationLineId").removeClass("hidden");
};

//工作人口柱形图折线图切换
Screening.workForceBar = function () {
	$("#workForceLineId").hide();
	$("#workForceBarId").show();
};

//工作人口柱形图折线图切换
Screening.workForceLine = function () {
	$("#workForceBarId").hide();
	$("#workForceLineId").show();
	$("#workForceLineId").removeClass("hidden");
};

//途经人口柱线图折线图切换
Screening.passingPopulationBar = function () {
	$("#passingPopulationLineId").hide();
	$("#passingPopulationBarId").show();
};

//途经人口柱线图折线图切换
Screening.passingPopulationLine = function () {
	$("#passingPopulationBarId").hide();
	$("#passingPopulationLineId").show();
	$("#passingPopulationLineId").removeClass("hidden");
};

//出行人口柱线图折线图切换
Screening.travelPopulationBar = function () {
	$("#travelPopulationLineId").hide();
	$("#travelPopulationBarId").show();
};
//出现人口柱状图折线图切换
Screening.travelPopulationLine = function () {
	$("#travelPopulationBarId").hide();
	$("#travelPopulationLineId").show();
	$("#travelPopulationLineId").removeClass("hidden");
};

//忠诚度柱状图饼图切换
Screening.loyaltyBar = function () {
	$("#loyaltyPieId").hide();
	$("#loyaltyBarId").show();
};

//忠诚度柱状图饼图切换
Screening.loyaltyPie = function () {
	$("#loyaltyBarId").hide();
	$("#loyaltyPieId").show();
	$("#loyaltyPieId").removeClass("hidden");
};

//性别分布状图饼图切换
Screening.sexDistributionBar = function () {
	$("#sexDistributionPieId").hide();
	$("#sexDistributionBarId").show();
};

//性别分布状图饼图切换
Screening.sexDistributionPie = function () {
	$("#sexDistributionBarId").hide();
	$("#sexDistributionPieId").show();
	$("#sexDistributionPieId").removeClass("hidden");
};
//年龄分布状图饼图切换
Screening.ageDistributionBar = function () {
	$("#ageDistributionPieId").hide();
	$("#ageDistributionBarId").show();
};

//年龄分布状图饼图切换
Screening.ageDistributionPie = function () {
	$("#ageDistributionBarId").hide();
	$("#ageDistributionPieId").show();
	$("#ageDistributionPieId").removeClass("hidden");
};

//籍贯分布状图饼图切换
Screening.nativeDistributionBar = function () {
	$("#nativeDistributionPieId").hide();
	$("#nativeDistributionBarId").show();
};

//籍贯分布状图饼图切换
Screening.nativeDistributionPie = function () {
	$("#nativeDistributionBarId").hide();
	$("#nativeDistributionPieId").show();
	$("#nativeDistributionPieId").removeClass("hidden");
};

//终端分布状图饼图切换
Screening.terminalDistributionBar = function () {
	$("#terminalDistributionPieId").hide();
	$("#terminalDistributionBarId").show();
};

//终端分布状图饼图切换
Screening.terminalDistributionPie = function () {
	$("#terminalDistributionBarId").hide();
	$("#terminalDistributionPieId").show();
	$("#terminalDistributionPieId").removeClass("hidden");
};

//月消费分布状图饼图切换
Screening.monthlyDistributionBar = function () {
	$("#monthlyDistributionPieId").hide();
	$("#monthlyDistributionBarId").show();
};

//月消费分布状图饼图切换
Screening.monthlyDistributionPie = function () {
	$("#monthlyDistributionBarId").hide();
	$("#monthlyDistributionPieId").show();
	$("#monthlyDistributionPieId").removeClass("hidden");
};

//实时客流查询
Screening.realPassengerSearch = function () {
	realPassenger();
};

//峰值客流查询
Screening.peakPassengerSearch = function () {
	peakPassenger();
};

//累计客流查询
Screening.cumulativePassengerSearch = function () {
	cumulativePassenger();
};


//常驻人口查询
Screening.permanentPopulationSearch = function () {
	permanent();
};
//工作人口查询
Screening.workForceSearch = function () {
	workForce();
};

//途经人口查询
Screening.passingPopulationSearch = function () {
	passingPopulation();
};

//出行人口查询
Screening.travelPopulationSearch = function () {
	travelPopulation();
};

//性别分布查询
Screening.sexDistributionSerch = function () {
	sex();
};

//籍贯分布查询
Screening.nativeDistributionSerch = function () {
	nativePoupation();
};

//终端分布查询
Screening.terminalDistributionSerch = function () {
	terminalPoupation();
};

//客源地查询
Screening.originDistributionSerch = function () {
	originlPoupation();
};

//年龄分布查询
Screening.ageDistributionSerch = function () {
	age();
	
};

//客流密度查询
Screening.passengerDensitySearch = function () {
	passengerDensity();
};

//月消费分布查询
Screening.monthlyConsumptionSerch = function () {
	consumptionPoupation();
};

//逗留情况分布查询
Screening.staySituationSearch = function () {
	stayPoupation();
}; 

//子区域逗留时间查询
Screening.staySituationRankingSearch = function () {
	stayPoupationRanking();
}; 

//忠诚度分布查询
Screening.loyaltyPopulationSearch = function () {
	loyaltyPoupation();
}; 
//ztree树形展示
var setting = {
	view: {
		showIcon: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable: true
		}
	},
	callback: {
		beforeClick: beforeClick,
		onClick: onClick
	}
};

var log, className = "dark";

function beforeClick(treeId, treeNode, clickFlag) {
	showLog(treeNode.level);
	if(treeNode.level==0){
		return false
	}else{
		return true;
	}
}
function showLog(str) {
	console.log(str);
}
function getTime() {
	var now= new Date(),
	h=now.getHours(),
	m=now.getMinutes(),
	s=now.getSeconds();
	return (h+":"+m+":"+s);
}
var customStartDate;//开始时间
var customEndDate;//结束时间
//日历
var myDaterangepickerDay = {
		format: 'YYYYMMDD',
		dateLimit : { days : 31 },             //起止时间的最大间隔
		showDropdowns : false,
		"linkedCalendars": true,
		"showCustomRangeLabel": false,
		"alwaysShowCalendars": true,
		"opens": "right",
		maxDate:moment().subtract(1, 'days').format('YYYYMMDD'),
		startDate: customStartDate,
		endDate: customEndDate,
		locale : {  
			format: 'YYYYMMDD',
			applyLabel : '确定',  
			cancelLabel : '取消',  
			fromLabel : '起始时间',  
			toLabel : '结束时间',  
			customRangeLabel : '自定义',  
			daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],  
			monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',  
			     '七月', '八月', '九月', '十月', '十一月', '十二月' ],  
			firstDay : 1  
		},
		buttonClasses : [ 'btn btn-success' ],  
		applyClass : 'btn-small btn-primary blue',  
		cancelClass : 'btn-small'
}

var myDaterangepickerHour = {
		forceParse: 0, ///选择后直接带回；要加！
		format: 'YYYYMMDD',
		singleDatePicker: true,
		showDropdowns : true,
		"linkedCalendars": false,
		"showCustomRangeLabel": false,
		"alwaysShowCalendars": false,
		"opens": "right",
		maxDate:moment().subtract(1, 'days').format('YYYYMMDD'),
		startDate: moment().subtract(1, 'days').format('YYYYMMDD'),
		locale : {  
			format: 'YYYYMMDD',
			applyLabel : '确定',  
			cancelLabel : '取消',  
			customRangeLabel : '自定义',  
			daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],  
			monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',  
			     '七月', '八月', '九月', '十月', '十一月', '十二月' ],  
			firstDay : 1  
		},
		buttonClasses : [ 'btn btn-success' ],  
		applyClass : 'btn-small btn-primary blue',  
		cancelClass : 'btn-small'
}

var myDaterangepickerMonth = {
		forceParse: 0, ///选择后直接带回；要加！
		format: 'YYYYMM',
		singleDatePicker: true,
		showDropdowns : true,
		"linkedCalendars": false,
		"showCustomRangeLabel": false,
		"alwaysShowCalendars": false,
		"opens": "right",
		startDate: moment().subtract(1, 'month').startOf('month').format('YYYYMM'),
		locale : {  
			format: 'YYYYMM',
			applyLabel : '确定',  
			cancelLabel : '取消',  
			customRangeLabel : '自定义',  
			daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],  
			monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',  
			     '七月', '八月', '九月', '十月', '十一月', '十二月' ],  
			firstDay : 1  
		},
		buttonClasses : [ 'btn btn-success' ],  
		applyClass : 'btn-small btn-primary blue',  
		cancelClass : 'btn-small'
}



//实时客流日历
var realPassengerStartTime;
function realPassengerTime(){
	realPeopleTime = moment(); 
	realPassengerStartTime =realPeopleTime.format('YYYYMMDD');
	$('#realPassenger-demo').daterangepicker({
        forceParse: 0, ///选择后直接带回；要加！
        format: 'YYYY-MM-DD',
   	 	singleDatePicker: true,
        showDropdowns : true,
        maxDate:new Date(),
        startDate: realPeopleTime,
        "linkedCalendars": true,
        "showCustomRangeLabel": true,
        "alwaysShowCalendars": true,
        "opens": "right",  
        locale : {  
        	format: 'YYYYMMDD',
       	 	applyLabel : '确定',  
            cancelLabel : '取消',  
            customRangeLabel : '自定义',  
            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],  
            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',  
                    '七月', '八月', '九月', '十月', '十一月', '十二月' ],  
            firstDay : 1  
        },
        buttonClasses : [ 'btn btn-success' ],  
        applyClass : 'btn-small btn-primary blue',  
        cancelClass : 'btn-small'
    },function realPassenger(start, end, label) {
   	 	beginTimeTake = start;
        if(!this.startDate){
            this.element.val('');
            realPassengerStartTime = $('#realPassenger-demo').html(beginTimeTake.format('YYYYMMDD')).val();
        }else{
            this.element.val(this.startDate.format(this.locale.format));
            realPassengerStartTime = $('#realPassenger-demo').html(beginTimeTake.format('YYYYMMDD')).val();
        }
    });
}

//累计客流日历
var cumulativePassengerStartTime;
var cumulativePassengerEndTime;
function cumulativePassengerTime(){
	var cumulativePassengerText = $("#selectCumulativePassenger").find("option:selected").text();
	
	if(cumulativePassengerText=='日'){
		cumulativePassengerStart = moment().subtract(30, 'days'); 
		cumulativePassengerEnd = moment().subtract(1, 'days'); ;
		customStartDate = cumulativePassengerStart;
		customEndDate = cumulativePassengerEnd;
		function cumulativePassenger(cumulativePassengerStart, cumulativePassengerEnd) {
			$('#config-demo').html(cumulativePassengerStart.format('YYYYMMDD') + ' - ' + cumulativePassengerEnd.format('YYYYMMDD'));
			cumulativePassengerStartTime = cumulativePassengerStart.format('YYYYMMDD');
			cumulativePassengerEndTime = cumulativePassengerEnd.format('YYYYMMDD');
		}
		myDaterangepickerDay.startDate = customStartDate;
		myDaterangepickerDay.endDate = customEndDate;
		$('#config-demo').daterangepicker(myDaterangepickerDay, cumulativePassenger);
		cumulativePassenger(cumulativePassengerStart, cumulativePassengerEnd);
	}
	
	if(cumulativePassengerText=='月'){
		cumulativePassengerStartTime = moment().format('YYYY');
		myDaterangepickerHour.format = 'YYYY';
		myDaterangepickerHour.locale.format = 'YYYY';
		myDaterangepickerHour.startDate = cumulativePassengerStartTime;
		$('#config-demo').daterangepicker(myDaterangepickerHour,function cumulativePassenger(start, end, label) {
			cumulativePassengerStartTime = start;
		    if(!this.startDate){
		        this.element.val('');
		        cumulativePassengerStartTime = $('#config-demo').html(cumulativePassengerStartTime.format('YYYY')).val();
		    }else{
		        this.element.val(this.startDate.format(this.locale.format));
		        cumulativePassengerStartTime = $('#config-demo').html(cumulativePassengerStartTime.format('YYYY')).val();
		    }
		});
	}
}


//客源地日历
var originPassengerStartTime;
var originPassengerEndTime;
function originPassengerTime(){
	originPassengerStart = moment().subtract(30, 'days'); 
	originPassengerEnd = moment().subtract(1, 'days');;
	function originPassenger(originPassengerStart, originPassengerEnd) {
		$('#origin-demo').html(originPassengerStart.format('YYYYMMDD') + ' - ' + originPassengerEnd.format('YYYYMMDD'));
		originPassengerStartTime = originPassengerStart.format('YYYYMMDD');
		originPassengerEndTime = originPassengerEnd.format('YYYYMMDD');
	}
	customStartDate = originPassengerStart;
	customEndDate = originPassengerEnd;
	myDaterangepickerDay.startDate = customStartDate;
	myDaterangepickerDay.endDate = customEndDate;
	$('#origin-demo').daterangepicker(myDaterangepickerDay, originPassenger);
	originPassenger(originPassengerStart, originPassengerEnd);
}

//性别分布时间
var sexStartTime;
var sexEndTime;
function sexPassengerTime(){
	sexStart = moment().subtract(30, 'days'); 
	sexEnd = moment().subtract(1, 'days');;
	function sexPassenger(sexStart, sexEnd) {
		$('#sex-demo').html(sexStart.format('YYYYMMDD') + ' - ' + sexEnd.format('YYYYMMDD'));
		sexStartTime = sexStart.format('YYYYMMDD');
		sexEndTime = sexEnd.format('YYYYMMDD');
	}
	customStartDate = sexStart;
	customEndDate = sexEnd;
	myDaterangepickerDay.startDate = customStartDate;
	myDaterangepickerDay.endDate = customEndDate;
	$('#sex-demo').daterangepicker(myDaterangepickerDay, sexPassenger);
	sexPassenger(sexStart, sexEnd);
}


//年龄分布时间
var ageStartTime;
var ageEndTime;
function agePassengerTime(){
	ageStart = moment().subtract(30, 'days'); 
	ageEnd = moment().subtract(1, 'days');;
	function agePassenger(ageStart, ageEnd) {
		$('#age-demo').html(ageStart.format('YYYYMMDD') + ' - ' + ageEnd.format('YYYYMMDD'));
		ageStartTime = ageStart.format('YYYYMMDD');
		ageEndTime = ageEnd.format('YYYYMMDD');
	}
	customStartDate = ageStart;
	customEndDate = ageEnd;
	myDaterangepickerDay.startDate = customStartDate;
	myDaterangepickerDay.endDate = customEndDate;
	$('#age-demo').daterangepicker(myDaterangepickerDay, agePassenger);
	agePassenger(ageStart, ageEnd);
}

//籍贯分布时间
//var nativeStartTime;
//var nativeEndTime;
//function nativePassengerTime(){
//	nativeStart = moment().subtract(30, 'days'); 
//	nativeEnd = moment();
//	function nativePassenger(nativeStart, nativeEnd) {
//		$('#native-demo').html(nativeStart.format('YYYYMMDD') + ' - ' + nativeEnd.format('YYYYMMDD'));
//		nativeStartTime = nativeStart.format('YYYYMMDD');
//		nativeEndTime = nativeEnd.format('YYYYMMDD');
//	}
//	customStartDate = nativeStart;
//	customEndDate = nativeEnd;
//	myDaterangepickerDay.startDate = customStartDate;
//	myDaterangepickerDay.endDate = customEndDate;
//	$('#native-demo').daterangepicker(myDaterangepickerDay, nativePassenger);
//	nativePassenger(nativeStart, nativeEnd);
//}


//终端分布时间
var terminalStartTime;
var terminalEndTime;
function terminalPassengerTime(){
	terminalStart = moment().subtract(30, 'days'); 
	terminalEnd = moment().subtract(1, 'days');;
	function terminalPassenger(terminalStart, terminalEnd) {
		$('#terminal-demo').html(terminalStart.format('YYYYMMDD') + ' - ' + terminalEnd.format('YYYYMMDD'));
		terminalStartTime = terminalStart.format('YYYYMMDD');
		terminalEndTime = terminalEnd.format('YYYYMMDD');
	}
	customStartDate = terminalStart;
	customEndDate = terminalEnd;
	myDaterangepickerDay.startDate = customStartDate;
	myDaterangepickerDay.endDate = customEndDate;
	$('#terminal-demo').daterangepicker(myDaterangepickerDay, terminalPassenger);
	terminalPassenger(terminalStart, terminalEnd);
}

//月消费分布时间
var monthlyStartTime;
var monthlyEndTime;
function monthlyPassengerTime(){
	monthlyStart = moment().subtract(30, 'days'); 
	monthlyEnd = moment().subtract(1, 'days');
	function monthlyPassenger(monthlyStart, monthlyEnd) {
		$('#monthlyDistribution-demo').html(monthlyStart.format('YYYYMMDD') + ' - ' + monthlyEnd.format('YYYYMMDD'));
		monthlyStartTime = monthlyStart.format('YYYYMMDD');
		monthlyEndTime = monthlyEnd.format('YYYYMMDD');
	}
	customStartDate = monthlyStart;
	customEndDate = monthlyEnd;
	myDaterangepickerDay.startDate = customStartDate;
	myDaterangepickerDay.endDate = customEndDate;
	$('#monthlyDistribution-demo').daterangepicker(myDaterangepickerDay, monthlyPassenger);
	monthlyPassenger(monthlyStart, monthlyEnd);
}

//常驻人口分布时间
var permanentStartTime;
function permanentPopulationTime(){
	permanentStartTime = moment().format('YYYY');
	myDaterangepickerHour.format = 'YYYY';
	myDaterangepickerHour.locale.format = 'YYYY';
	myDaterangepickerHour.startDate = permanentStartTime;
	$('#permanentPopulation-demo').daterangepicker(myDaterangepickerHour,function permanentPopulation(start, end, label) {
		permanentStartTime = start;
		if(!this.startDate){
		    this.element.val('');
		    permanentStartTime = permanentStartTime.format(this.locale.format);
		}else{
		    this.element.val(this.startDate.format(this.locale.format));
		    permanentStartTime = permanentStartTime.format(this.locale.format);
		}
	});
}


//工作人口分布时间
var workForceStartTime;
function workForcePopulationTime(){
	workForceStartTime = moment().format('YYYY');
	myDaterangepickerHour.format = 'YYYY';
	myDaterangepickerHour.locale.format = 'YYYY';
	myDaterangepickerHour.startDate = workForceStartTime;
	$('#workForce-demo').daterangepicker(myDaterangepickerHour,function workForcePopulation(start, end, label) {
	 	workForceStartTime = start;
	    if(!this.startDate){
	        this.element.val('');
	        workForceStartTime = workForceStartTime.format(this.locale.format);
	    }else{
	        this.element.val(this.startDate.format(this.locale.format));
	        workForceStartTime = workForceStartTime.format(this.locale.format);
	    }
	});
}


//途经人口日历
var passingPopulationStartTime;
var passingPopulationEndTime;
function passingPopulationTime(){
	var passingPopulationText = $("#selectPassingPopulation").find("option:selected").text();
	if(passingPopulationText=='天'){
		passingPopulationStart = moment().subtract(30, 'days'); 
		passingPopulationEnd= moment().subtract(1, 'days');
		function passingPopulation(passingPopulationStart, passingPopulationEnd) {
		$('#passingPopulation-demo').html(passingPopulationStart.format('YYYYMMDD') + ' - ' + passingPopulationEnd.format('YYYYMMDD'));
			passingPopulationStartTime = passingPopulationStart.format('YYYYMMDD');
			passingPopulationEndTime = passingPopulationEnd.format('YYYYMMDD');
		}
		customStartDate = passingPopulationStart;
		customEndDate = passingPopulationEnd;
		myDaterangepickerDay.startDate = customStartDate;
		myDaterangepickerDay.endDate = customEndDate;
		$('#passingPopulation-demo').daterangepicker(myDaterangepickerDay, passingPopulation);
		passingPopulation(passingPopulationStart, passingPopulationEnd);
	}
	
	if(passingPopulationText=='小时'){
		passingPopulationStartTime = moment().subtract(1, 'days').format('YYYYMMDD');
		myDaterangepickerHour.format = 'YYYYMMDD';
		myDaterangepickerHour.locale.format = 'YYYYMMDD';
		myDaterangepickerHour.startDate = passingPopulationStartTime;
		$('#passingPopulation-demo').daterangepicker(myDaterangepickerHour,function passingPopulation(start, end, label) {
			passingPopulationStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    passingPopulationStartTime = passingPopulationStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    passingPopulationStartTime = passingPopulationStartTime.format(this.locale.format);
			}
	 	});
	}
}


//出行人口日历
var travelPopulationStartTime;
var travelPopulationEndTime;
function travelPopulationTime(){
	var travelPopulationText = $("#selectTravelPopulation").find("option:selected").text();
	if(travelPopulationText=='天'){
		travelPopulationStart = moment().subtract(30, 'days'); 
		travelPopulationEnd= moment().subtract(1, 'days')
		function travelPopulation(travelPopulationStart, travelPopulationEnd) {
			$('#travel-demo').html(travelPopulationStart.format('YYYYMMDD') + ' - ' + travelPopulationEnd.format('YYYYMMDD'));
			travelPopulationStartTime = travelPopulationStart.format('YYYYMMDD');
			travelPopulationEndTime = travelPopulationEnd.format('YYYYMMDD');
		}
		customStartDate = travelPopulationStart;
		customEndDate = travelPopulationEnd;
		myDaterangepickerDay.startDate = customStartDate;
		myDaterangepickerDay.endDate = customEndDate;
		$('#travel-demo').daterangepicker(myDaterangepickerDay, travelPopulation);
	    travelPopulation(travelPopulationStart, travelPopulationEnd);
	}
	
	if(travelPopulationText=='小时'){
		travelPopulationStartTime = moment().subtract(1, 'days').format('YYYYMMDD');
		myDaterangepickerHour.format = 'YYYYMMDD';
		myDaterangepickerHour.locale.format = 'YYYYMMDD';
		myDaterangepickerHour.startDate = travelPopulationStartTime;
		$('#travel-demo').daterangepicker(myDaterangepickerHour,function travelPopulation(start, end, label) {
			travelPopulationStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    travelPopulationStartTime = travelPopulationStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    travelPopulationStartTime = travelPopulationStartTime.format(this.locale.format);
			}
		});
	}
}

//客流密度日历
var passengerDensityStartTime;
var passengerDensityEndTime;
function passengerDensityTime(){
	var passengerDensityText = $("#selectPassengerDensity").find("option:selected").text();
	if(passengerDensityText=='月'){
		passengerDensityStart = moment().subtract(30, 'days'); 
		passengerDensityEnd= moment().subtract(1, 'days');
		function passengerDensity(passengerDensityStart, passengerDensityEnd) {
			$('#passengerDensity-demo').html(passengerDensityStart.format('YYYYMMDD') + ' - ' + passengerDensityEnd.format('YYYYMMDD'));
			passengerDensityStartTime = passengerDensityStart.format('YYYYMMDD');
			passengerDensityEndTime = passengerDensityEnd.format('YYYYMMDD');
		}
		customStartDate = passengerDensityStart;
		customEndDate = passengerDensityEnd;
		myDaterangepickerDay.startDate = customStartDate;
		myDaterangepickerDay.endDate = customEndDate;
		$('#passengerDensity-demo').daterangepicker(myDaterangepickerDay, passengerDensity);
		passengerDensity(passengerDensityStart, passengerDensityEnd);
	}
	
	if(passengerDensityText=='天'){
		passengerDensityStartTime = moment().subtract(1, 'days').format('YYYYMMDD');
		myDaterangepickerHour.format = 'YYYYMMDD';
		myDaterangepickerHour.locale.format = 'YYYYMMDD';
		myDaterangepickerHour.startDate = passengerDensityStartTime;
		$('#passengerDensity-demo').daterangepicker(myDaterangepickerHour,function passengerDensity(start, end, label) {
			passengerDensityStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    passengerDensityStartTime = passengerDensityStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    passengerDensityStartTime = passengerDensityStartTime.format(this.locale.format);
			}
		});
	}
}


//峰值客流日历
var peakPassengerStartTime;
var peakPassengerEndTime;
function peakPassengerTime(){
	var peakPassengerText = $("#selectPeakPassengerFlow").find("option:selected").text();
	if(peakPassengerText=='日'){
		peakPassengerStart = moment().subtract(30, 'days'); 
		peakPassengerEnd= moment().subtract(1, 'days');
		customStartDate = peakPassengerStart;
		customEndDate = peakPassengerEnd;
		function peakPassenger(peakPassengerStart, peakPassengerEnd) {
			$('#peakPassenger-demo').html(peakPassengerStart.format('YYYYMMDD') + ' - ' + peakPassengerEnd.format('YYYYMMDD'));
			peakPassengerStartTime = peakPassengerStart.format('YYYYMMDD');
			peakPassengerEndTime = peakPassengerEnd.format('YYYYMMDD');
		}
		myDaterangepickerDay.startDate = customStartDate;
		myDaterangepickerDay.endDate = customEndDate;
		$('#peakPassenger-demo').daterangepicker(myDaterangepickerDay, peakPassenger);
	    peakPassenger(peakPassengerStart, peakPassengerEnd);
	}
	if(peakPassengerText=='月'){
		peakPassengerStartTime = moment().format('YYYY');
		myDaterangepickerHour.format = 'YYYY';
		myDaterangepickerHour.locale.format = 'YYYY';
		myDaterangepickerHour.startDate = peakPassengerStartTime;
		$('#peakPassenger-demo').daterangepicker(myDaterangepickerHour,function peakPassenger(start, end, label) {
		 	peakPassengerStartTime = start;
		    if(!this.startDate){
		        this.element.val('');
		        peakPassengerStartTime = peakPassengerStartTime.format(this.locale.format);
		    }else{
		        this.element.val(this.startDate.format(this.locale.format));
		        peakPassengerStartTime = peakPassengerStartTime.format(this.locale.format);
		    }
		});
	}
}

//逗留情况日历
var staySituationStartTime;
function staySituationTime(){
	var staySituationText = $("#selectStaySituationTime").find("option:selected").text();
	if(staySituationText=='天'){
		staySituationStartTime = moment().subtract(1, 'month').startOf('month').format('YYYYMM');
		$('#staySituation-demo').daterangepicker(myDaterangepickerMonth,function staySituation(start, end, label) {
			staySituationStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    staySituationStartTime = staySituationStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    staySituationStartTime = staySituationStartTime.format(this.locale.format);
			}
	 	});
	}
	
	if(staySituationText=='小时'){
		staySituationStartTime = moment().subtract(1, 'days').format('YYYYMMDD');
		myDaterangepickerHour.format = 'YYYYMMDD';
		myDaterangepickerHour.locale.format = 'YYYYMMDD';
		myDaterangepickerHour.startDate = staySituationStartTime;
		$('#staySituation-demo').daterangepicker(myDaterangepickerHour,function staySituation(start, end, label) {
			staySituationStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    staySituationStartTime = staySituationStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    staySituationStartTime = staySituationStartTime.format(this.locale.format);
			}
	 	});
	}
}

//子区域平均逗留时长日历
var staySituationRankingStartTime;
function staySituationRankingTime(){
	var staySituationRankingText = $("#selectStaySituationRankingTime").find("option:selected").text();
	if(staySituationRankingText=='天'){
		staySituationRankingStartTime = moment().subtract(1, 'month').startOf('month').format('YYYYMM');
		$('#staySituationRanking-demo').daterangepicker(myDaterangepickerMonth,function staySituationRanking(start, end, label) {
			staySituationRankingStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    staySituationRankingStartTime = staySituationRankingStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    staySituationRankingStartTime = staySituationRankingStartTime.format(this.locale.format);
			}
	 	});
	}
	
	if(staySituationRankingText=='小时'){
		staySituationRankingStartTime = moment().subtract(1, 'days').format('YYYYMMDD');
		myDaterangepickerHour.format = 'YYYYMMDD';
		myDaterangepickerHour.locale.format = 'YYYYMMDD';
		myDaterangepickerHour.startDate = staySituationRankingStartTime;
		$('#staySituationRanking-demo').daterangepicker(myDaterangepickerHour,function staySituationRanking(start, end, label) {
			staySituationRankingStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    staySituationRankingStartTime = staySituationRankingStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    staySituationRankingStartTime = staySituationRankingStartTime.format(this.locale.format);
			}
	 	});
	}
}

//忠诚度日历
var loyaltyStartTime;
function loyaltyTime(){
	loyaltyStartTime = moment().subtract(1, 'month').startOf('month').format('YYYYMM');
		$('#loyalty-demo').daterangepicker(myDaterangepickerMonth,function loyaltyPopulation(start, end, label) {
			loyaltyStartTime = start;
			if(!this.startDate){
			    this.element.val('');
			    loyaltyStartTime = loyaltyStartTime.format(this.locale.format);
			}else{
			    this.element.val(this.startDate.format(this.locale.format));
			    loyaltyStartTime = loyaltyStartTime.format(this.locale.format);
			}
	 	});
}

function addArea(data){
	for(k=0;k<data.length;k++){
		var lonLat = data[k].lonLat;
		if(lonLat != null && lonLat != ""){
			var polygonArr = lonLat.split("&");        
			for(i=0;i<polygonArr.length;i++){
				var polygon = new BMap.Polygon();
				var points = [];
				var pointArr = polygonArr[i].split(";");
				for(j=0;j<pointArr.length;j++){
					var lon = pointArr[j].split(",")[0];
					var lat = pointArr[j].split(",")[1];
					var point = new BMap.Point(lon,lat);
					points.push(point);
				}
				polygon.setPath(points);
				var color = thiessenPolygonColorByIndex(data[k]);
				polygon.setStrokeWeight(1)
				polygon.setFillColor(color)
				polygon.setFillOpacity(0.6)
				map.addOverlay(polygon);
			}
		}
	}
}

function thiessenPolygonColorByIndex(data) {
	var popCount = data.popCount;
	var warningValue = data.warningValue;
	var saturationValue = data.saturationValue;
	var severeValue = data.severeValue;
	var index;
	if(popCount>0 && popCount<=warningValue){
		index = 0;
	}else if(popCount>warningValue && popCount<=saturationValue){
		index = 1;
	}else if(popCount>saturationValue && popCount<=severeValue){
		index = 2;
	}else if(popCount>severeValue){
		index = 3;
	}
    var colors = ['#46B035', '#9BC702', '#FFAE00', '#FD3023'];
    //var colors = ['#46B035', '#9BC702', '#FFAE00', '#FF7200', '#FD3023']
    return colors[index]
}

var city;
var lon;
var lat;
var lonLat;
var areaId;
var subAreaId;
var ztree;
function onClick(event, treeId, treeNode, clickFlag) {
	showLog("[ "+getTime()+" onClick ]&nbsp;&nbsp;clickFlag = " + clickFlag + " (" + (clickFlag===1 ? "普通选中": (clickFlag===0 ? "<b>取消选中</b>" : "<b>追加选中</b>")) + ")");
	showLog(treeNode);
	var id = treeNode.id;
	var level = treeNode.level;
	$("#selectArea").html(treeNode.name);
	if(level==1){
		$("#areaId").val(id);
		$("#subAreaId").val("");
		findName();
		areaReset();
	}else if(level==2){
		var parentNode=treeNode.getParentNode();
		$("#areaId").val(parentNode.id);
		$("#subAreaId").val(id);
		findName();
		areaReset();
	}
	
}

function getFirstAreaId(){
	var treeObj =  $.fn.zTree.getZTreeObj("areaTree");
	var nodes = treeObj.getNodes();
	for(i=0;i<nodes.length;i++){
		if(nodes[i].children!=undefined ){
			var childnodes = nodes[i].children;
			for(j=0;j<childnodes.length;i++){
				if(childnodes[j].id!=undefined ){
					return childnodes[j];
				}else{
					return null;
				}
			}
		}
	}
}

function findName(){
	areaname = $("#selectArea").html();
	areaId =$("#areaId").val();
	if(areaId==null||areaId==''){
		var area=getFirstAreaId();
		if(area!=null){
			areaId=area.id;
			$("#selectArea").html(area.name);
		};
	}
	subAreaId =$("#subAreaId").val();
	var findNameAjax = new $ax(Feng.ctxPath + "/screening/findName?areaId="+areaId+"&subAreaId="+subAreaId, function (data) {
		//alert(JSON.stringify(data));
		//这里做了转义处理
		data = JSON.parse(data);
		city=data[0].cityName;
		lon=data[0].lon;
		lat=data[0].lat;
		lonLat=data.lonLat;
		map = new BMap.Map("allmap"); // 创建Map实例
	    map.setCurrentCity(city);  // 设置地图显示的城市 此项是必须设置的
	    map.centerAndZoom(new BMap.Point(lon, lat), 14);
	    map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
	    map.addOverlay(new BMap.Marker(new BMap.Point(lon, lat)));
	    addArea(data);
	}, function (data) {
		map = new BMap.Map("allmap"); // 创建Map实例
		map.setCurrentCity("湖北省");  // 设置地图显示的城市 此项是必须设置的
		map.centerAndZoom("湖北省", 9);
		map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
	});
	findNameAjax.start();
}

$(function () {
	ztree = new $ZTree("areaTree", "/screening/tree");
	ztree.setSettings(setting);
    ztree.init();
	findName();
	cumulativePassengerTime();//累计客流
	realPassengerTime();//实时客流
	originPassengerTime();//客源地
	sexPassengerTime();//性别分布
	agePassengerTime();//年龄分布
//	nativePassengerTime();//籍贯分布
	terminalPassengerTime();//终端分布
	monthlyPassengerTime();//月消费分布
	permanentPopulationTime();//常驻人口
	workForcePopulationTime();//工作人口
	passingPopulationTime();//途经人口
	travelPopulationTime();//出行人口
	passengerDensityTime();//客流密度
	peakPassengerTime();//峰值客流
	staySituationTime();//逗留情况
	staySituationRankingTime();//子区域平均逗留时长
	loyaltyTime();//忠诚度
	areaname = $("#selectArea").html();
	//加载ztre
	$(".dropdown-menu").on('click', function (e) {
        e.stopPropagation();
    });
	var windowWidth = $(window).width();
    var chartWidth = $(".echarts").width(windowWidth*0.88);
    $(window).resize( function(){
        var windowWidth = $(window).width();
        var chartWidth = $(".echarts").width(windowWidth*0.88);
    });
    if($("#realTimePassenger").length > 0) {
    realTimePassenger = echarts.init(document.getElementById("realTimePassenger"));//实时客流
    }
    if($("#peakPassengerFlow").length > 0) {
    peakPassengerFlow = echarts.init(document.getElementById("peakPassengerFlow"));//峰值客流
    }
    if($("#cumulativePassengerFlow").length > 0) {
    cumulativePassengerFlow = echarts.init(document.getElementById("cumulativePassengerFlow"));//累计客流
    cumulativePassengerFlowLine = echarts.init(document.getElementById("cumulativePassengerFlowLine"));//累计客流折线图
    }
    if($("#staySituationBar").length > 0) {
    staySituationBar = echarts.init(document.getElementById("staySituationBar"));//逗留情况柱形图
    staySituationPie = echarts.init(document.getElementById("staySituationPie"));//逗留情况饼图
    }
    if($("#staySituationRankingBarChart").length > 0) {
    	staySituationRankingBar = echarts.init(document.getElementById("staySituationRankingBarChart"));//子区域平均逗留时长柱形图
    }
    if($("#originBar").length > 0) {
    originBar = echarts.init(document.getElementById("originBar"));//客源地柱状图
    originPie = echarts.init(document.getElementById("originPie"));//客源地饼图
    }
    if($("#passengerDensityLine").length > 0) {
    passengerDensityLine = echarts.init(document.getElementById("passengerDensityLine"));//客流密度柱线图
    }
    if($("#permanentPopulationBar").length > 0) {
    permanentPopulationBar = echarts.init(document.getElementById("permanentPopulationBar"));//常驻人口柱线图
    permanentPopulationLine = echarts.init(document.getElementById("permanentPopulationLine"));//常驻人口折线图
    }
    if($("#workForceBar").length > 0) {
    workForceBar = echarts.init(document.getElementById("workForceBar"));//工作人口柱线图
    workForceLine = echarts.init(document.getElementById("workForceLine"));//工作人口折线图
    }
    if($("#passingPopulationBar").length > 0) {
    passingPopulationBar = echarts.init(document.getElementById("passingPopulationBar"));//途经人口柱状图
    passingPopulationLine = echarts.init(document.getElementById("passingPopulationLine"));//途经人口折线图
    }
    if($("#travelPopulationBar").length > 0) {
    travelPopulationBar = echarts.init(document.getElementById("travelPopulationBar"));//出行人口柱状图
    travelPopulationLine = echarts.init(document.getElementById("travelPopulationLine"));//出行人口折线图
    }
    if($("#loyaltyBar").length > 0) {
    loyaltyBar = echarts.init(document.getElementById("loyaltyBar"));//忠诚度柱状图
    loyaltyPie = echarts.init(document.getElementById("loyaltyPie"));//忠诚度柱饼图
    }
    if($("#sexDistributionLine").length > 0) {
    sexDistributionLine = echarts.init(document.getElementById("sexDistributionLine"));//性别分布折线图
    sexDistributionBar = echarts.init(document.getElementById("sexDistributionBar"));//性别分布柱线图
    sexDistributionPie = echarts.init(document.getElementById("sexDistributionPie"));//性别分布饼图
    }
    if($("#ageDistributionLine").length > 0) {
    ageDistributionLine = echarts.init(document.getElementById("ageDistributionLine"));//年龄分布折线图
    ageDistributionBar = echarts.init(document.getElementById("ageDistributionBar"));//年龄分布柱状图
    ageDistributionPie = echarts.init(document.getElementById("ageDistributionPie"));//年龄分布柱状图
    }
//    nativeDistributionBar = echarts.init(document.getElementById("nativeDistributionBar"));//年龄分布柱状图
//    nativeDistributionPie = echarts.init(document.getElementById("nativeDistributionPie"));//年龄分布柱状图
    if($("#terminalDistributionBar").length > 0) {
    terminalDistributionBar = echarts.init(document.getElementById("terminalDistributionBar"));//终端分布柱状图
    terminalDistributionPie = echarts.init(document.getElementById("terminalDistributionPie"));//终端分布饼图
    }
    if($("#monthlyDistributionBar").length > 0) {
    monthlyDistributionBar = echarts.init(document.getElementById("monthlyDistributionBar"));//月消费分布柱状图
    monthlyDistributionPie = echarts.init(document.getElementById("monthlyDistributionPie"));//月消费分布饼图
    }
    componentReset();
    
   
    $(window).resize( function(){
        var windowWidth = $(window).width();
        var chartWidth = $(".echarts").width(windowWidth*0.9);
    });
    
    //实时客流时间选择
    $("#selectRealPassenger").click(function (){
    	var $selected = $("#selectRealPassenger").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
    });
    
    //实时客流人口选择
    $("#selectRealPeople").change(function (){
    	var $selected = $("#selectRealPeople").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        realPassenger();
    });
    
   //实时客流时间粒度选择
    $("#selectRealPeopleTime").change(function (){
    	var $selected = $("#selectRealPeopleTime").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        realPassenger();
    });
    
    
    //峰值客流时间选择
    $("#selectPeakPassengerFlow").change(function (){
    	var $selected = $("#selectPeakPassengerFlow").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        peakPassengerTime();
        peakPassenger();
    });
    
  	//峰值客流人口选择
    $("#selectpeakPassenger").change(function (){
    	var $selected = $("#selectpeakPassenger").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        peakPassenger();
    });
    
    //累计客流时间选择
   	// var text;
    $("#selectCumulativePassenger").change(function (){
		var $selected = $("#selectCumulativePassenger").find("option:selected");//所选中的下拉框选项  
		var text= $selected.text();//所选中的文本（显示在页面的文本）  
		cumulativePassengerTime();
       	cumulativePassenger();
    });
    
    $("#selectStaySituationTime").change(function (){
		var $selected = $("#selectStaySituationTime").find("option:selected");//所选中的下拉框选项  
		var text= $selected.text();//所选中的文本（显示在页面的文本）  
    });
    
    
  	//累计客流人口选择
    $("#selectCumulativePassengerPeople").change(function (){
    	var $selected = $("#selectCumulativePassengerPeople").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        cumulativePassenger();
    });
    
    
  	//途经人口选择
    $("#selectPassingPopulation").change(function (){
    	var $selected = $("#selectPassingPopulation").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        passingPopulationTime();
        passingPopulation();
    });
    
    //逗留情况时间
    $("#selectStaySituationTime").change(function (){
    	var $selected = $("#selectStaySituationTime").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        staySituationTime();
        stayPoupation();
    });
    
  //子区域平均逗留时长
    $("#selectStaySituationRankingTime").change(function (){
    	var $selected = $("#selectStaySituationRankingTime").find("option:selected");//所选中的下拉框选项  
        var text= $selected.text();//所选中的文本（显示在页面的文本）  
        staySituationRankingTime();
        stayPoupationRanking();
    });
    
    
    
});

//客源地区域选择
$("#selectOrigin").change(function (){
	var $selected = $("#selectOrigin").find("option:selected");//所选中的下拉框选项  
    var text= $selected.text();//所选中的文本（显示在页面的文本）  
    originlPoupation();
});

//客流密度时间选择
$("#selectPassengerDensity").change(function (){
	//passengerDensityFY
	var $selected = $("#selectPassengerDensity").find("option:selected");//所选中的下拉框选项  
    var text= $selected.text();//所选中的文本（显示在页面的文本） 
    passengerDensityTime();
    passengerDensity();
});


//出行人口时间选择
$("#selectTravelPopulation").change(function (){
	var $selected = $("#selectTravelPopulation").find("option:selected");//所选中的下拉框选项  
    var text= $selected.text();//所选中的文本（显示在页面的文本）  
    travelPopulationTime();
    travelPopulation();
});

//性别分布时间选择
$("#selectSexDistribution").change(function (){
	var $selected = $("#selectSexDistribution").find("option:selected");//所选中的下拉框选项  
    var text= $selected.text();//所选中的文本（显示在页面的文本）  
    sex();
    
});

//年龄分布时间选择
$("#selectAgeDistribution").change(function (){
	var $selected = $("#selectAgeDistribution").find("option:selected");//所选中的下拉框选项  
    var text= $selected.text();//所选中的文本（显示在页面的文本）  
    age();
    //agePassengerTime();
});

//籍贯分布区域选择
$("#selectNativeDistribution").change(function (){
	var $selected = $("#selectNativeDistribution").find("option:selected");//所选中的下拉框选项  
    var text= $selected.text();//所选中的文本（显示在页面的文本）  
    nativePoupation();
});